#ifdef ROBOTRACONTEUR_USE_STDAFX
#include "stdafx.h"
#endif

#include "ServiceTestClient.h"
#include "array_compare.h"
#include "multidim_array_util.h"

using namespace std;
using namespace boost;
using namespace RobotRaconteur;
using namespace com::robotraconteur::testing::TestService1;
using namespace com::robotraconteur::testing::TestService2;
using namespace RobotRaconteur::test;

using std::exception;

namespace RobotRaconteurTest
{

static void ServiceTestClient_Service_Listener(RR_SHARED_PTR<ClientContext> ctx, ClientServiceListenerEventType evt,
                                               RR_SHARED_PTR<void> p)
{
    std::cout << evt;
    if (evt == ClientServiceListenerEventType_ServicePathReleased)
    {
        std::cout << " path: " << *RR_STATIC_POINTER_CAST<std::string>(p);
    }
    std::cout << endl;
}

void ServiceTestClient::ConnectService(string url)
{

    r = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(
        url, "", RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >(), &ServiceTestClient_Service_Listener));
}

void ServiceTestClient::RunFullTest(string url, string authurl)
{

    ConnectService(url);

    cout << "Test Members" << endl;
    TestProperties();
    TestFunctions();

    TestEvents();
    TestObjRefs();

    TestPipes();
    TestCallbacks();
    TestWires();
    TestMemories();

    DisconnectService();

    // boost::this_thread::sleep(boost::posix_time::milliseconds(100));
    cout << "Test Authentication" << endl;
    TestAuthentication(authurl);

    cout << "Test Object Locks" << endl;
    TestObjectLock(authurl);

    cout << "Test Monitor Locks" << endl;
    TestMonitorLock(url);

    cout << "Test Async" << endl;
    TestAsync(authurl);

    cout << "Done" << endl;
}

void ServiceTestClient::RunMinimalTest(string url)
{

    ASSERT_NO_THROW(ConnectService(url););

    // TestProperties();

    // basic double properties
    EXPECT_NO_THROW(r->set_d1(3.456));
    EXPECT_NO_THROW(EXPECT_DOUBLE_EQ(r->get_d1(), 12.345));
    double d2_a[] = {
        8.805544e-12,  3.735066e+12,  3.491919e+17,  4.979833e+12,  -4.042302e+00, 2.927731e-12,  5.945355e+11,
        -3.965351e+06, 4.866934e-14,  1.314597e+04,  -2.059923e-11, -5.447989e-20, 1.267732e-21,  -2.603983e+10,
        2.417961e+03,  3.515469e-16,  1.731329e-01,  -2.854408e-04, 2.908090e-06,  3.354746e+08,  9.405914e+05,
        -3.665276e-01, -2.036897e+02, 3.489765e-01,  -3.207702e+11, -2.105708e+18, -1.485891e+13, -7.059704e+04,
        3.528381e+11,  4.586056e+02,  -8.107050e-16, -1.007106e+09, 2.964453e+05,  -3.628810e+05, -2.816870e-14,
        5.665387e+09,  8.518736e+11,  -1.179981e+12, -1.506569e-21, 1.113076e-06,  -4.782847e+06, 8.906463e+17,
        2.729604e+03,  -3.430604e+16, 2.626956e-07,  1.543395e+15,  3.407777e-21,  1.231519e+06,  -4.808410e+16,
        2.649811e+10,  2.546524e+01,  -3.533472e-13, -3.732759e+04, 1.951505e-20,  9.338953e-21,  -1.627672e-04,
        1.807084e-19,  -4.489206e-17, -2.654284e+08, -2.136947e+16, -3.690031e+09, 3.372245e-14,  4.946361e-11,
        -1.330965e-01, 2.479789e-17,  2.750331e-18,  -4.301452e-03, 3.895091e+19,  2.515863e+13,  6.879298e+12,
        -2.925884e-15, -2.826248e+00, -4.864526e-06, 2.614765e+00,  4.488816e-19,  2.231337e+15,  -7.004595e+07,
        2.506835e-08,  -2.187450e-02, -2.220025e-07, 1.688346e+02,  8.125250e-07,  -4.819391e+10, -1.643306e-14,
        -4.768222e-18, -4.472162e-16, 2.487563e-01,  -3.924904e-15, -1.186331e+06, 2.397369e+01,  -3.137448e-02,
        1.016507e+06,  2.584749e-16,  8.212180e-08,  1.631561e-12,  -4.927066e-08, 1.448920e-14,  -4.371505e+03,
        2.050871e-21,  2.523287e+01,  7.778552e-05,  -4.437786e+18, -1.118552e-07, -3.543717e-09, -5.327587e-07,
        -1.083197e-17, 2.578295e-10,  -4.952430e-12, -3.008597e-13, 3.010829e+01,  -6.109332e+09, -2.428341e-03,
        9.399191e-01,  -4.827230e-06, 1.013860e+10,  -2.870341e-20, 4.281756e+11,  1.043519e-09,  2.378027e+06,
        2.605309e+09,  -4.939600e-04, -2.193966e+08, 4.022755e-03,  2.668705e-09,  -1.087393e-18, 1.927676e-12,
        -1.694835e+10, 3.554035e-03,  -1.299796e+01, -1.692862e+07, 2.818156e+07,  -2.606821e-13, 1.629588e-15,
        -7.069991e-16, 1.205863e-19,  2.491209e-17,  -3.757951e+04, 3.110266e-04,  -4.339472e+11, -3.172428e+02,
        1.579905e+09,  2.859499e-01,  4.241852e-06,  2.043341e-09,  2.922865e-16,  -2.580974e+01, -3.147566e-02,
        1.160590e+03,  -2.238096e+01, -1.984601e-13, 2.636096e-03,  8.422872e-04,  2.026040e-16,  -3.822500e+01,
        -2.190513e-18, 3.229839e-11,  -2.958164e+06, -8.354021e+11, 3.625367e+08,  -4.558085e-01, 1.274325e+04,
        -2.492750e+05, 3.739269e+18,  -3.985407e-03, 3.575816e-13,  1.376847e+06,  -6.682659e-20, -9.200014e+08,
        -2.278973e+10, -3.555184e-04, 3.821512e-10,  5.944167e+07,  -2.576511e-15, 1.232459e+02,  -3.187831e+02,
        -4.882568e+12, -1.670486e+05, -2.339878e-20, -4.985496e-16, -2.937093e+17, 8.981723e-06,  -5.460686e-04,
        1.090528e-11,  -4.321598e+17, -3.577227e-08, 2.880194e+01,  -4.277921e+00, -4.145678e-02, 4.930810e+08,
        -4.525745e-21, 4.648764e+07,  -2.564920e+16, 1.075546e+01,  3.777591e-18,  1.419816e-08,  1.419490e+10,
        1.479453e-19,  -4.933130e+13, 4.580471e+15,  -3.160785e+02, -2.885209e+06, 2.384424e-03,  1.030777e-12,
        2.652784e+04,  4.435144e+10,  3.102484e+17,  4.725294e+11,  -3.817788e-04, 4.074841e-01,  -7.248042e-13,
        -4.502531e-08, 2.203521e+01,  -4.457124e+01, -2.961745e+06, -3.237080e+14, -3.482497e-19, 1.534088e+05,
        4.759060e-14,  2.333791e+04,  -4.002051e-03, 3.278553e-06,  -2.307217e+13, -2.999411e+19, -9.804484e+02,
        -1.793367e+01, 3.111735e+07,  -4.457329e+10, -2.067659e-13, -5.927573e+03, 6.979879e+10,  3.556110e-06,
        -3.513094e-13, 1.128057e+19,  4.199038e+13,  7.553080e-20,  4.380028e-11,  -2.502103e-19, 5.943049e+15,
        -1.266134e-10, 4.825578e-09,  -2.778134e-16, 1.881866e-10,  -3.677556e+08, -2.166345e-10, 3.919158e+05,
        2.778912e-07,  1.822489e-05,  1.513496e-01,  9.327925e+05,  -4.050132e-14, 3.311913e+01,  9.290544e+15,
        1.302267e+03,  -1.252080e+17, -4.208811e-04, -3.225464e+16, 2.093787e+16,  -3.352116e+07, 4.797665e+15,
        -1.539672e-17, 4.835159e+04,  2.446236e-07,  2.355328e-17,  2.044244e-12,  3.210415e-11,  -1.322741e+16,
        5.538184e-14,  -4.612046e-05, 4.758939e+15,  -2.038208e-10, -2.451148e+18, -2.699711e-19, -2.019804e-09,
        5.631634e-13,  -2.288031e+05, -3.211488e+12, 7.511869e+13,  -3.209453e-09, 3.806128e-18,  4.025006e-14,
        -1.700945e-10, 4.136280e-13,  4.517870e-04,  2.739233e+11,  -3.736057e-03, 2.255379e-20,  3.122584e-16,
        3.192660e-18,  4.765755e-09,  2.396494e-13,  1.625326e+02,  -3.413821e-18, 3.627586e+10,  8.708108e+07,
        2.244241e-09,  3.718827e-02,  1.803394e-18,  4.377806e-04,  1.593155e-04,  -2.886859e+19, 2.446955e-06,
        4.714172e-07,  -1.444181e+14, 5.921228e-22,  -3.968436e+05, 2.081487e+08,  4.200042e+18,  -1.334353e-20,
        1.637913e+12,  -7.203262e+03, 3.510359e+09,  5.945107e-08,  2.798793e-07,  1.819020e+17,  -1.331690e+02,
        -2.714485e+18, -2.344350e-18, -1.313232e-20, -6.739364e-22, 1.025007e-02,  1.186976e+07,  -1.412268e+09,
        -6.194861e-18, -4.523625e-03, -4.504270e-06, 2.158726e-21,  -8.330465e-17, 4.566938e+11,  6.677905e-05,
        -2.312717e-13, 5.325983e+16,  -1.075392e-04, 1.140532e-13,  2.606136e-11,  -2.815243e+16, -3.550714e-16,
        -1.033372e+05, -1.183041e+03, -7.872171e-21, -4.362058e-07, -3.181126e-07, -2.676671e+18, -2.674920e-15,
        -3.991169e-16, -4.401799e+07, -2.826847e-10, -2.033266e-20, -5.669789e-11, 3.711339e+05,  -1.194584e-17,
        -3.310173e+10, -1.743331e-15, -2.288755e+15, 8.610375e+06,  4.796813e+07,  -1.465344e+07, -4.074823e-12,
        2.089962e-21,  -4.171761e-18, -4.682371e+18, 4.030447e+08,  4.679856e-07,  -2.662732e+15, 2.551805e-21,
        2.482089e+05,  -2.310281e-10, 3.533837e-08,  1.829437e-07,  3.074466e-06,  -2.889997e-12, -4.203806e+01,
        1.598374e-21,  -1.300526e-05, 2.921093e+14,  -8.847920e+14, 3.788583e-04,  -4.538453e+19, -2.734893e+07,
        1.351281e-04,  1.128593e-01,  3.868545e+13,  -1.200438e+18, -2.641822e+10, -4.493835e-16, -6.291094e-13,
        2.534337e-08,  -4.063653e-03, 3.200675e-02,  2.243642e+08,  5.170843e-08,  8.984841e-14,  2.228243e-01,
        -6.770559e-09, 3.513375e-16,  -2.512038e-14, 3.421696e+04,  -4.514522e+01, -1.062799e-20, 2.853168e-19,
        8.503515e-21,  -1.664790e-03, -2.515606e-18, 1.237958e-21,  -8.059224e-20, 4.386086e+00,  5.301466e+17,
        4.388106e-12,  -3.432129e+00, 2.189230e+18,  -1.806446e-02, 3.266789e-18,  3.355664e-13,  -1.206966e-21,
        -4.813560e-02, -1.352049e+18, 1.257234e-07,  2.511470e-09,  -2.512775e-01, 3.613773e-10,  -9.065202e+16,
        -1.777852e+18, 1.444606e-01,  -2.857379e+00, -1.912993e+00, 3.436817e-09,  -1.749039e+14, 2.215154e-18,
        3.384923e+18,  -4.513038e-09, 4.814904e+05,  3.730911e+15,  1.861706e+12,  3.378290e-03,  2.851468e-06,
        -1.577518e-04, -4.122504e-12, -2.743002e+03, 8.512568e-02,  -1.333039e-09, -4.899609e-17, -1.782085e-11,
        2.552482e-02,  4.200193e+10,  -4.298147e+03, -1.923210e-10, -1.208889e+01, 4.606772e-21,  -3.331241e+10,
        -3.704566e-16, -3.733178e-20, -4.950049e+16, 3.184384e+15,  -4.107375e-06, 1.801875e+09,  9.632951e-16,
        7.172728e-10,  2.324621e+07,  2.892586e+15,  -1.582511e-17, -4.119044e-13, -1.248361e+09, 1.531907e+08,
        -1.795628e-19, -1.735919e-17, -4.646689e-07, -2.779304e-11, 8.048984e-10,  3.536087e-02,  -6.494880e+18,
        2.714073e+06,  3.374557e+18,  3.621468e-06,  2.742652e-07,  2.551176e+03,  -4.420578e+18, -4.370624e-08,
        -4.507765e-11, 4.193746e-20,  1.206645e+13,  -3.750231e+03, 4.390893e+08,  -9.756466e+11, 3.392778e-06,
        -3.453465e+01, -1.406102e+11, -3.673526e-15, 1.417082e-03,  1.499926e+16,  -4.471032e-17, -2.657920e+16,
        4.792261e+09,  -3.212735e+17, -3.372737e-05, -4.730048e+01, 3.365478e+07,  2.835695e+13,  -3.242022e-07,
        3.640288e+11,  1.862055e-08,  -4.121250e-19, -3.891100e-02, -4.367058e-15, 1.364067e-17,  -4.575429e-12,
        3.621347e-07,  1.506864e+11,  3.715065e+18,  -1.773352e+08, -3.502359e+07, -2.326890e-04, 2.948814e-17,
        -2.438988e+14, -2.994787e+04, -3.755515e+12, 2.708013e-13,  3.281046e-01,  -3.710727e+12, -8.380304e+14,
        1.062737e-05,  2.385939e+16,  -4.383210e-20, -3.779417e+03, 3.080324e-03,  3.810188e+16,  3.058415e+00,
        -2.484879e-21, -1.951684e+01, 6.979033e-10,  -3.866994e+06, 4.278936e-19,  9.365131e+10,  -3.685205e+01,
        -2.678752e-16, 2.011434e-19,  1.884072e+08,  -1.300910e+04, 2.414058e-09,  -4.675979e+11, 3.583361e-19,
        -4.499438e+18, 1.641999e-21,  -2.686795e-10, 6.136688e-20,  -3.793690e+16, 4.944562e-20,  -3.490443e-03,
        3.080547e+02,  2.041413e-06,  2.021979e+03,  2.314233e-06,  1.564131e-01,  -8.712542e+17, 7.569081e+16,
        -1.056907e+17, 2.095024e-14,  -2.487621e+17, -3.490381e+19, -6.944641e-01, -2.892354e-08, -3.597351e+12,
        -1.985424e+06, -2.348859e+09, -1.657051e+01, -3.358823e+14, 3.219974e-16,  -4.819092e-13, -2.905178e-11,
        8.257664e+04,  -4.092466e-15, -3.464711e-13, -3.956400e-14, -2.548275e-08, -8.917872e-21, 7.387291e+13,
        2.300996e+16,  -4.870764e+18, -9.909380e-03, 1.260429e-08,  -3.409396e-12, 1.003848e+02,  -4.883178e-02,
        -3.125474e-14, 1.005294e+11,  -4.736012e+09, -1.647544e-09, -3.491431e-03, 4.619061e+07,  -4.547601e-09,
        -3.788900e-02, -2.648380e-17, 4.601877e-16,  1.754357e+13,  4.325616e+12,  1.860822e+03,  4.080727e+15,
        -4.573470e-14, -1.293538e+16, 2.811449e+05,  4.032351e+06,  4.274005e+04,  3.454035e-21,  4.933014e+09,
        -3.712562e+08, 3.158678e+06,  -1.636782e+11, -2.884298e-18, -3.685740e-17, 1.027472e-07,  -3.765173e-12,
        2.740894e-17,  2.634880e+02,  -4.334010e+00, -3.708285e-14, -3.858731e+16, -3.956687e+13, -4.064064e-12,
        2.558646e-05,  4.459143e+03,  -9.661948e+03, -1.994335e+16, 1.202714e-17,  -3.782707e-17, 9.099692e-04,
        -1.864561e+09, 3.493877e-08,  4.288188e-01,  1.767126e-14,  -6.779451e-22, -1.977471e-09, -3.536454e+06,
        -7.319495e-04, 2.004028e-16,  -3.181521e-17, 3.336202e+14,  -2.752423e+07, 3.390953e+01,  4.199625e-15,
        2.883232e-12,  3.122912e-06,  7.324619e-19,  3.092709e-02,  -2.758364e-15, -2.489492e+12, -1.622009e-08,
        2.371204e+06,  -1.582081e+08, -6.382371e-17};
    EXPECT_NO_THROW(r->set_d2(AttachRRArray(d2_a, 647, false)));
    double d2_b[] = {
        1.374233e+19,  2.424327e-04,  -1.615609e-02, 3.342963e-21,  -4.308134e+14, -1.783430e-07, 2.214302e+18,
        -1.091018e+17, 3.279396e-20,  2.454183e-01,  1.459922e+07,  -3.494941e+16, -7.949200e-21, 1.720101e+17,
        -1.041015e+16, 1.453541e+05,  1.125846e+06,  1.894394e+07,  1.153038e-17,  -3.283589e+06, 2.253268e-10,
        -3.897051e+06, 1.362011e+05,  5.501697e-19,  -4.854610e+01, -1.582705e-05, 7.622313e+04,  2.104642e+08,
        -1.294512e-06, -1.426230e-19, -4.319619e-15, 9.837716e+03,  -4.949316e-01, -2.173576e+02, 2.730509e-19,
        -2.123803e+05, 1.652596e-17,  -2.066863e-09, 3.856560e-08,  1.379652e+18,  -2.119906e+16, 4.860679e-05,
        -1.681801e-10, -1.569650e-15, 3.984306e-21,  3.283336e+08,  -9.222510e-16, -3.579521e-02, 1.279363e-05,
        3.920153e-12,  4.737275e-15,  -4.427587e+06, -3.826670e-14, 2.492484e-04,  4.996082e+09,  4.643228e-11,
        2.809952e-17,  -2.224883e-13, -4.442602e+18, 4.422736e+11,  4.969282e-18,  4.937908e-15,  6.973867e-22,
        1.908796e-19,  4.812115e-08,  1.753516e-02,  -3.684764e+02, 1.557482e-17,  -1.176997e-11, 1.772798e-05,
        4.877622e-16,  1.107926e+11,  4.097985e-14,  2.714049e-18,  3.198732e+15,  -1.052497e-01, -5.003982e+07,
        -1.538353e-04, 3.045308e+17,  1.176208e-18,  1.268710e-10,  -1.269719e-05, -2.989599e+00, -3.721343e-11,
        -1.444196e-10, -2.030635e+04, 2.070258e+16,  -3.001278e-14, 1.116018e+14,  4.999239e+15,  4.286177e-21,
        -2.972550e+10, 3.549075e-20,  -2.874186e-06, 2.994430e+09,  2.978356e+10,  -2.364977e+07, 2.807278e-01,
        -3.279567e-10, 4.567428e+05,  1.612242e+07,  4.102315e+05,  -1.069501e-20, 2.887812e+10,  4.384194e-09,
        -2.936771e-11, -4.164448e+07, 3.391389e+04,  -3.923673e+17, -2.735518e-22, -2.019257e-01, 3.014806e+15,
        -3.885050e-15, -2.806241e-20, 3.077066e+18,  -1.574438e+14, -3.131588e+19, 4.812541e+03,  4.435881e+16,
        -3.843380e+02, -7.522165e+03, -3.668055e-21, 2.603478e-08,  2.928775e+08,  2.892123e+00,  -1.594119e+04,
        -4.817379e-01, -2.121948e+03, -8.872132e-09, -3.909318e-06, -3.849648e-14, -4.554589e+18, 4.410297e-15,
        -2.976295e-04, -2.298802e+10, 4.981337e-07,  5.364781e-12,  1.536953e+07,  -4.082889e-07, 1.670759e-21,
        4.009147e-13,  -4.691543e-18, -2.597887e-13, 2.368696e+18,  -2.585884e-07, -5.209726e-03, -2.568300e+06,
        2.184692e-20,  -1.799204e+16, 1.397292e+04,  4.277966e+13,  -4.072388e+09, -2.324749e+16, -4.717399e+10,
        -2.853124e-05, -3.664750e+11, -3.864796e-08, 3.265198e+07,  -3.309827e+19, 3.222296e+03,  2.366113e-19,
        -3.425143e+14, 1.627821e-08,  4.987622e+00,  -1.402489e-17, -1.303904e+15, -2.042850e+17, -1.399340e+09,
        -3.560871e+05, -4.251240e-21, -7.806581e-10, 1.723498e+00,  -2.030115e+08, 4.595621e-19,  1.174387e-10,
        3.474174e+14,  -4.159866e+03, -1.833464e-19, -3.650925e+05, 3.757361e-03,  -1.854280e-10, -1.856982e-13,
        1.685338e+08,  4.051670e-11,  4.095232e+03,  -2.956025e-16, 4.986423e-05,  4.941458e+10,  4.145946e+11,
        3.402975e+14,  -1.954363e+11, -2.274907e+10, -3.162121e-17, -5.027950e-07, 4.135173e-02,  -3.777913e-04,
        -4.898637e+15, 2.354747e-02,  -6.884549e+13, -1.896920e-05, -1.914414e+15, -1.196744e-19, -4.692974e-01,
        8.586675e-10,  -2.204766e-17, -3.586447e-14, 1.751276e+17,  -2.546189e-05, -2.248796e+03, -9.445830e+02,
        1.150138e+03,  4.586691e+11,  -2.582686e-15, -2.795788e+12, -3.409768e+07, -2.172186e-03, -1.457882e+06,
        -4.153022e+13, -4.255977e-08, 3.216237e-07,  4.935803e+02,  -4.248965e-16, 1.740357e+07,  4.635370e+19,
        -4.099930e-14, 2.758885e-16,  -4.714106e-05, -4.556226e-20, -4.290894e-19, 1.174284e-09,  -1.443257e+16,
        -2.279471e-08, -3.030819e-16, 1.535128e+18,  -3.248271e-07, 3.079855e-21,  -3.056403e-02, -1.368113e-12,
        4.004190e-10,  4.955150e+07,  -2.494283e-16, 2.186037e+05,  -1.232946e+03, 5.586112e-05,  -2.288144e+17,
        2.515602e-19,  -4.064132e+08, -3.217400e-02, -2.620215e+07, 2.283421e-14,  -1.130075e+08, 3.304955e-03,
        1.352402e+01,  6.255755e-03,  -3.913649e-08, 5.474984e+01,  -4.712294e-08, 3.548418e-16,  1.276896e+12,
        2.007320e-08,  3.025617e+04,  -2.544836e+14, -2.087825e+17, -3.285556e-09, 2.605304e+07,  -1.876210e+07,
        3.734943e-10,  -3.862726e-15, -4.227362e-05, 1.267773e+14,  -1.706991e-05, 3.737441e+10,  2.641527e+01,
        4.439891e+10,  -1.444933e-05, -2.190034e-12, 8.059924e-18,  -1.324313e+18, -1.420214e-10, 3.940158e-20,
        3.943349e-02,  -2.685925e+19, 4.334133e-05,  3.171371e-21,  2.094486e+12,  1.331741e+03,  1.205892e-02,
        1.791416e+04,  3.899239e+10,  6.581991e+06,  -3.860368e+11, -3.853916e-02, 1.314566e+09,  3.923126e+03,
        -3.509905e+13, -4.332430e+06, -1.713419e+01, -1.244104e-14, -5.529613e+01, 6.630349e+06,  1.053668e+10,
        3.312332e-05,  -1.252220e+08, 3.997107e-07,  1.847068e-13,  -2.393157e-11, -2.083719e-10, -4.927155e+11,
        2.666499e-15,  4.087292e-10,  4.082567e-10,  -2.017655e+07, 9.108015e+15,  -4.199693e-15, -4.969705e-17,
        1.769881e-02,  1.745504e+00,  2.200377e-16,  -4.404838e-06, -1.317122e-15, 7.210560e+08,  1.282439e-18,
        -3.204957e-06, -1.624277e+05, 4.570975e-22,  1.261776e+04,  4.416193e+12,  -4.343457e-18, 4.095420e-14,
        4.951026e-09,  2.261753e-15,  4.125062e+05,  -4.448849e+11, -3.184924e+06, -2.050956e+05, -9.895539e+09,
        4.541548e+11,  -4.230580e+11, -4.268059e-15, -4.393836e+09, -2.514832e-08, 3.322394e-04,  2.597384e-18,
        1.316619e-11,  -2.250081e+16, 2.179579e-10,  -1.838295e+04, -1.995626e-17, -4.656110e+17, 3.481814e-07,
        -2.859273e-11, -2.011768e-06, -1.809342e-17, -3.242126e+10, -1.873723e+08, -2.833009e-12, -3.758282e+12,
        2.970198e+15,  -2.667738e-01, -3.689173e+11, 1.008362e-10,  -1.526867e-20, -1.439753e+06, -6.154602e+16,
        4.165816e+00,  -1.597823e-09, -1.862803e+14, -2.222766e+15, -2.892587e+17, -4.230426e-14, 2.999121e-21,
        1.642245e+00,  1.590694e-14,  -4.469755e-06, 2.700655e+12,  -1.822443e-02, -4.889338e-16, -3.174990e-11,
        4.146024e-03,  1.313280e+01,  3.235142e+15,  3.500547e+00,  -4.413708e+03, 1.485548e+16,  -1.660821e-11,
        -4.334510e-22, -1.209739e+04, 1.149570e+12,  -4.537849e+00, -3.628402e-16, 2.748853e-12,  -4.818907e-21};
    EXPECT_RRARRAY_EQ(AttachRRArray(d2_b, 392, false), r->get_d2());
    double d3_a[] = {9.025110e-18, 3.567231e+17, 2.594489e+01, 2.311708e-04, 7.345164e+13, 6.550284e-01,
                     1.969554e+12, 9.451979e-05, 5.900637e-09, 9.975667e+03, 6.549533e-17, 2.227145e-13,
                     2.822132e+18, 4.332600e+18, 1.485466e+05, 5.844952e-14};
    EXPECT_NO_THROW(r->set_d3(AttachRRArray(d3_a, 16, false)));
    double d3_b[] = {2.047398e-20, 2.091541e-20, 9.084241e+14, 1.583413e+01, 5.168067e-02, 1.360920e-11,
                     9.818531e-21, 6.293083e+07, 4.406956e-14, 8.540213e-09, 7.329310e-03, 5.566796e+00,
                     3.968358e-08, 4.928656e-08, 5.994301e-20, 8.281551e-21};
    EXPECT_RRARRAY_EQ(AttachRRArray(d3_b, 16, false), r->get_d3());
    double d4_a[] = {-4.207179e-09, -3.611333e+11, -4.155626e-06, -2.458459e+10, 2.826045e-11,
                     3.511191e-08,  4.759250e-07,  2.455883e+09,  4.182578e+11,  4.732337e-14,
                     -2.967313e+02, -4.139188e+14, 6.287269e+03};
    EXPECT_NO_THROW(r->set_d4(AttachRRArray(d4_a, 13, false)));
    double d4_b[] = {2.864760e-08, 3.900663e+13, 9.105789e+11, 2.943743e-15, -2.823159e-16, -3.481261e+19};
    EXPECT_RRARRAY_EQ(AttachRRArray(d4_b, 6, false), r->get_d4());

    TestFunctions();

    TestEvents();
    // TestObjRefs();

    /*TestPipes();
    TestCallbacks();
    TestWires();
    TestMemories();*/

    EXPECT_NO_THROW(DisconnectService(););
}

void ServiceTestClient::TestProperties()
{

    // basic double properties
    EXPECT_NO_THROW(r->set_d1(3.456));
    EXPECT_NO_THROW(EXPECT_DOUBLE_EQ(r->get_d1(), 12.345));
    double d2_a[] = {
        8.805544e-12,  3.735066e+12,  3.491919e+17,  4.979833e+12,  -4.042302e+00, 2.927731e-12,  5.945355e+11,
        -3.965351e+06, 4.866934e-14,  1.314597e+04,  -2.059923e-11, -5.447989e-20, 1.267732e-21,  -2.603983e+10,
        2.417961e+03,  3.515469e-16,  1.731329e-01,  -2.854408e-04, 2.908090e-06,  3.354746e+08,  9.405914e+05,
        -3.665276e-01, -2.036897e+02, 3.489765e-01,  -3.207702e+11, -2.105708e+18, -1.485891e+13, -7.059704e+04,
        3.528381e+11,  4.586056e+02,  -8.107050e-16, -1.007106e+09, 2.964453e+05,  -3.628810e+05, -2.816870e-14,
        5.665387e+09,  8.518736e+11,  -1.179981e+12, -1.506569e-21, 1.113076e-06,  -4.782847e+06, 8.906463e+17,
        2.729604e+03,  -3.430604e+16, 2.626956e-07,  1.543395e+15,  3.407777e-21,  1.231519e+06,  -4.808410e+16,
        2.649811e+10,  2.546524e+01,  -3.533472e-13, -3.732759e+04, 1.951505e-20,  9.338953e-21,  -1.627672e-04,
        1.807084e-19,  -4.489206e-17, -2.654284e+08, -2.136947e+16, -3.690031e+09, 3.372245e-14,  4.946361e-11,
        -1.330965e-01, 2.479789e-17,  2.750331e-18,  -4.301452e-03, 3.895091e+19,  2.515863e+13,  6.879298e+12,
        -2.925884e-15, -2.826248e+00, -4.864526e-06, 2.614765e+00,  4.488816e-19,  2.231337e+15,  -7.004595e+07,
        2.506835e-08,  -2.187450e-02, -2.220025e-07, 1.688346e+02,  8.125250e-07,  -4.819391e+10, -1.643306e-14,
        -4.768222e-18, -4.472162e-16, 2.487563e-01,  -3.924904e-15, -1.186331e+06, 2.397369e+01,  -3.137448e-02,
        1.016507e+06,  2.584749e-16,  8.212180e-08,  1.631561e-12,  -4.927066e-08, 1.448920e-14,  -4.371505e+03,
        2.050871e-21,  2.523287e+01,  7.778552e-05,  -4.437786e+18, -1.118552e-07, -3.543717e-09, -5.327587e-07,
        -1.083197e-17, 2.578295e-10,  -4.952430e-12, -3.008597e-13, 3.010829e+01,  -6.109332e+09, -2.428341e-03,
        9.399191e-01,  -4.827230e-06, 1.013860e+10,  -2.870341e-20, 4.281756e+11,  1.043519e-09,  2.378027e+06,
        2.605309e+09,  -4.939600e-04, -2.193966e+08, 4.022755e-03,  2.668705e-09,  -1.087393e-18, 1.927676e-12,
        -1.694835e+10, 3.554035e-03,  -1.299796e+01, -1.692862e+07, 2.818156e+07,  -2.606821e-13, 1.629588e-15,
        -7.069991e-16, 1.205863e-19,  2.491209e-17,  -3.757951e+04, 3.110266e-04,  -4.339472e+11, -3.172428e+02,
        1.579905e+09,  2.859499e-01,  4.241852e-06,  2.043341e-09,  2.922865e-16,  -2.580974e+01, -3.147566e-02,
        1.160590e+03,  -2.238096e+01, -1.984601e-13, 2.636096e-03,  8.422872e-04,  2.026040e-16,  -3.822500e+01,
        -2.190513e-18, 3.229839e-11,  -2.958164e+06, -8.354021e+11, 3.625367e+08,  -4.558085e-01, 1.274325e+04,
        -2.492750e+05, 3.739269e+18,  -3.985407e-03, 3.575816e-13,  1.376847e+06,  -6.682659e-20, -9.200014e+08,
        -2.278973e+10, -3.555184e-04, 3.821512e-10,  5.944167e+07,  -2.576511e-15, 1.232459e+02,  -3.187831e+02,
        -4.882568e+12, -1.670486e+05, -2.339878e-20, -4.985496e-16, -2.937093e+17, 8.981723e-06,  -5.460686e-04,
        1.090528e-11,  -4.321598e+17, -3.577227e-08, 2.880194e+01,  -4.277921e+00, -4.145678e-02, 4.930810e+08,
        -4.525745e-21, 4.648764e+07,  -2.564920e+16, 1.075546e+01,  3.777591e-18,  1.419816e-08,  1.419490e+10,
        1.479453e-19,  -4.933130e+13, 4.580471e+15,  -3.160785e+02, -2.885209e+06, 2.384424e-03,  1.030777e-12,
        2.652784e+04,  4.435144e+10,  3.102484e+17,  4.725294e+11,  -3.817788e-04, 4.074841e-01,  -7.248042e-13,
        -4.502531e-08, 2.203521e+01,  -4.457124e+01, -2.961745e+06, -3.237080e+14, -3.482497e-19, 1.534088e+05,
        4.759060e-14,  2.333791e+04,  -4.002051e-03, 3.278553e-06,  -2.307217e+13, -2.999411e+19, -9.804484e+02,
        -1.793367e+01, 3.111735e+07,  -4.457329e+10, -2.067659e-13, -5.927573e+03, 6.979879e+10,  3.556110e-06,
        -3.513094e-13, 1.128057e+19,  4.199038e+13,  7.553080e-20,  4.380028e-11,  -2.502103e-19, 5.943049e+15,
        -1.266134e-10, 4.825578e-09,  -2.778134e-16, 1.881866e-10,  -3.677556e+08, -2.166345e-10, 3.919158e+05,
        2.778912e-07,  1.822489e-05,  1.513496e-01,  9.327925e+05,  -4.050132e-14, 3.311913e+01,  9.290544e+15,
        1.302267e+03,  -1.252080e+17, -4.208811e-04, -3.225464e+16, 2.093787e+16,  -3.352116e+07, 4.797665e+15,
        -1.539672e-17, 4.835159e+04,  2.446236e-07,  2.355328e-17,  2.044244e-12,  3.210415e-11,  -1.322741e+16,
        5.538184e-14,  -4.612046e-05, 4.758939e+15,  -2.038208e-10, -2.451148e+18, -2.699711e-19, -2.019804e-09,
        5.631634e-13,  -2.288031e+05, -3.211488e+12, 7.511869e+13,  -3.209453e-09, 3.806128e-18,  4.025006e-14,
        -1.700945e-10, 4.136280e-13,  4.517870e-04,  2.739233e+11,  -3.736057e-03, 2.255379e-20,  3.122584e-16,
        3.192660e-18,  4.765755e-09,  2.396494e-13,  1.625326e+02,  -3.413821e-18, 3.627586e+10,  8.708108e+07,
        2.244241e-09,  3.718827e-02,  1.803394e-18,  4.377806e-04,  1.593155e-04,  -2.886859e+19, 2.446955e-06,
        4.714172e-07,  -1.444181e+14, 5.921228e-22,  -3.968436e+05, 2.081487e+08,  4.200042e+18,  -1.334353e-20,
        1.637913e+12,  -7.203262e+03, 3.510359e+09,  5.945107e-08,  2.798793e-07,  1.819020e+17,  -1.331690e+02,
        -2.714485e+18, -2.344350e-18, -1.313232e-20, -6.739364e-22, 1.025007e-02,  1.186976e+07,  -1.412268e+09,
        -6.194861e-18, -4.523625e-03, -4.504270e-06, 2.158726e-21,  -8.330465e-17, 4.566938e+11,  6.677905e-05,
        -2.312717e-13, 5.325983e+16,  -1.075392e-04, 1.140532e-13,  2.606136e-11,  -2.815243e+16, -3.550714e-16,
        -1.033372e+05, -1.183041e+03, -7.872171e-21, -4.362058e-07, -3.181126e-07, -2.676671e+18, -2.674920e-15,
        -3.991169e-16, -4.401799e+07, -2.826847e-10, -2.033266e-20, -5.669789e-11, 3.711339e+05,  -1.194584e-17,
        -3.310173e+10, -1.743331e-15, -2.288755e+15, 8.610375e+06,  4.796813e+07,  -1.465344e+07, -4.074823e-12,
        2.089962e-21,  -4.171761e-18, -4.682371e+18, 4.030447e+08,  4.679856e-07,  -2.662732e+15, 2.551805e-21,
        2.482089e+05,  -2.310281e-10, 3.533837e-08,  1.829437e-07,  3.074466e-06,  -2.889997e-12, -4.203806e+01,
        1.598374e-21,  -1.300526e-05, 2.921093e+14,  -8.847920e+14, 3.788583e-04,  -4.538453e+19, -2.734893e+07,
        1.351281e-04,  1.128593e-01,  3.868545e+13,  -1.200438e+18, -2.641822e+10, -4.493835e-16, -6.291094e-13,
        2.534337e-08,  -4.063653e-03, 3.200675e-02,  2.243642e+08,  5.170843e-08,  8.984841e-14,  2.228243e-01,
        -6.770559e-09, 3.513375e-16,  -2.512038e-14, 3.421696e+04,  -4.514522e+01, -1.062799e-20, 2.853168e-19,
        8.503515e-21,  -1.664790e-03, -2.515606e-18, 1.237958e-21,  -8.059224e-20, 4.386086e+00,  5.301466e+17,
        4.388106e-12,  -3.432129e+00, 2.189230e+18,  -1.806446e-02, 3.266789e-18,  3.355664e-13,  -1.206966e-21,
        -4.813560e-02, -1.352049e+18, 1.257234e-07,  2.511470e-09,  -2.512775e-01, 3.613773e-10,  -9.065202e+16,
        -1.777852e+18, 1.444606e-01,  -2.857379e+00, -1.912993e+00, 3.436817e-09,  -1.749039e+14, 2.215154e-18,
        3.384923e+18,  -4.513038e-09, 4.814904e+05,  3.730911e+15,  1.861706e+12,  3.378290e-03,  2.851468e-06,
        -1.577518e-04, -4.122504e-12, -2.743002e+03, 8.512568e-02,  -1.333039e-09, -4.899609e-17, -1.782085e-11,
        2.552482e-02,  4.200193e+10,  -4.298147e+03, -1.923210e-10, -1.208889e+01, 4.606772e-21,  -3.331241e+10,
        -3.704566e-16, -3.733178e-20, -4.950049e+16, 3.184384e+15,  -4.107375e-06, 1.801875e+09,  9.632951e-16,
        7.172728e-10,  2.324621e+07,  2.892586e+15,  -1.582511e-17, -4.119044e-13, -1.248361e+09, 1.531907e+08,
        -1.795628e-19, -1.735919e-17, -4.646689e-07, -2.779304e-11, 8.048984e-10,  3.536087e-02,  -6.494880e+18,
        2.714073e+06,  3.374557e+18,  3.621468e-06,  2.742652e-07,  2.551176e+03,  -4.420578e+18, -4.370624e-08,
        -4.507765e-11, 4.193746e-20,  1.206645e+13,  -3.750231e+03, 4.390893e+08,  -9.756466e+11, 3.392778e-06,
        -3.453465e+01, -1.406102e+11, -3.673526e-15, 1.417082e-03,  1.499926e+16,  -4.471032e-17, -2.657920e+16,
        4.792261e+09,  -3.212735e+17, -3.372737e-05, -4.730048e+01, 3.365478e+07,  2.835695e+13,  -3.242022e-07,
        3.640288e+11,  1.862055e-08,  -4.121250e-19, -3.891100e-02, -4.367058e-15, 1.364067e-17,  -4.575429e-12,
        3.621347e-07,  1.506864e+11,  3.715065e+18,  -1.773352e+08, -3.502359e+07, -2.326890e-04, 2.948814e-17,
        -2.438988e+14, -2.994787e+04, -3.755515e+12, 2.708013e-13,  3.281046e-01,  -3.710727e+12, -8.380304e+14,
        1.062737e-05,  2.385939e+16,  -4.383210e-20, -3.779417e+03, 3.080324e-03,  3.810188e+16,  3.058415e+00,
        -2.484879e-21, -1.951684e+01, 6.979033e-10,  -3.866994e+06, 4.278936e-19,  9.365131e+10,  -3.685205e+01,
        -2.678752e-16, 2.011434e-19,  1.884072e+08,  -1.300910e+04, 2.414058e-09,  -4.675979e+11, 3.583361e-19,
        -4.499438e+18, 1.641999e-21,  -2.686795e-10, 6.136688e-20,  -3.793690e+16, 4.944562e-20,  -3.490443e-03,
        3.080547e+02,  2.041413e-06,  2.021979e+03,  2.314233e-06,  1.564131e-01,  -8.712542e+17, 7.569081e+16,
        -1.056907e+17, 2.095024e-14,  -2.487621e+17, -3.490381e+19, -6.944641e-01, -2.892354e-08, -3.597351e+12,
        -1.985424e+06, -2.348859e+09, -1.657051e+01, -3.358823e+14, 3.219974e-16,  -4.819092e-13, -2.905178e-11,
        8.257664e+04,  -4.092466e-15, -3.464711e-13, -3.956400e-14, -2.548275e-08, -8.917872e-21, 7.387291e+13,
        2.300996e+16,  -4.870764e+18, -9.909380e-03, 1.260429e-08,  -3.409396e-12, 1.003848e+02,  -4.883178e-02,
        -3.125474e-14, 1.005294e+11,  -4.736012e+09, -1.647544e-09, -3.491431e-03, 4.619061e+07,  -4.547601e-09,
        -3.788900e-02, -2.648380e-17, 4.601877e-16,  1.754357e+13,  4.325616e+12,  1.860822e+03,  4.080727e+15,
        -4.573470e-14, -1.293538e+16, 2.811449e+05,  4.032351e+06,  4.274005e+04,  3.454035e-21,  4.933014e+09,
        -3.712562e+08, 3.158678e+06,  -1.636782e+11, -2.884298e-18, -3.685740e-17, 1.027472e-07,  -3.765173e-12,
        2.740894e-17,  2.634880e+02,  -4.334010e+00, -3.708285e-14, -3.858731e+16, -3.956687e+13, -4.064064e-12,
        2.558646e-05,  4.459143e+03,  -9.661948e+03, -1.994335e+16, 1.202714e-17,  -3.782707e-17, 9.099692e-04,
        -1.864561e+09, 3.493877e-08,  4.288188e-01,  1.767126e-14,  -6.779451e-22, -1.977471e-09, -3.536454e+06,
        -7.319495e-04, 2.004028e-16,  -3.181521e-17, 3.336202e+14,  -2.752423e+07, 3.390953e+01,  4.199625e-15,
        2.883232e-12,  3.122912e-06,  7.324619e-19,  3.092709e-02,  -2.758364e-15, -2.489492e+12, -1.622009e-08,
        2.371204e+06,  -1.582081e+08, -6.382371e-17};
    EXPECT_NO_THROW(r->set_d2(AttachRRArray(d2_a, 647, false)));
    double d2_b[] = {
        1.374233e+19,  2.424327e-04,  -1.615609e-02, 3.342963e-21,  -4.308134e+14, -1.783430e-07, 2.214302e+18,
        -1.091018e+17, 3.279396e-20,  2.454183e-01,  1.459922e+07,  -3.494941e+16, -7.949200e-21, 1.720101e+17,
        -1.041015e+16, 1.453541e+05,  1.125846e+06,  1.894394e+07,  1.153038e-17,  -3.283589e+06, 2.253268e-10,
        -3.897051e+06, 1.362011e+05,  5.501697e-19,  -4.854610e+01, -1.582705e-05, 7.622313e+04,  2.104642e+08,
        -1.294512e-06, -1.426230e-19, -4.319619e-15, 9.837716e+03,  -4.949316e-01, -2.173576e+02, 2.730509e-19,
        -2.123803e+05, 1.652596e-17,  -2.066863e-09, 3.856560e-08,  1.379652e+18,  -2.119906e+16, 4.860679e-05,
        -1.681801e-10, -1.569650e-15, 3.984306e-21,  3.283336e+08,  -9.222510e-16, -3.579521e-02, 1.279363e-05,
        3.920153e-12,  4.737275e-15,  -4.427587e+06, -3.826670e-14, 2.492484e-04,  4.996082e+09,  4.643228e-11,
        2.809952e-17,  -2.224883e-13, -4.442602e+18, 4.422736e+11,  4.969282e-18,  4.937908e-15,  6.973867e-22,
        1.908796e-19,  4.812115e-08,  1.753516e-02,  -3.684764e+02, 1.557482e-17,  -1.176997e-11, 1.772798e-05,
        4.877622e-16,  1.107926e+11,  4.097985e-14,  2.714049e-18,  3.198732e+15,  -1.052497e-01, -5.003982e+07,
        -1.538353e-04, 3.045308e+17,  1.176208e-18,  1.268710e-10,  -1.269719e-05, -2.989599e+00, -3.721343e-11,
        -1.444196e-10, -2.030635e+04, 2.070258e+16,  -3.001278e-14, 1.116018e+14,  4.999239e+15,  4.286177e-21,
        -2.972550e+10, 3.549075e-20,  -2.874186e-06, 2.994430e+09,  2.978356e+10,  -2.364977e+07, 2.807278e-01,
        -3.279567e-10, 4.567428e+05,  1.612242e+07,  4.102315e+05,  -1.069501e-20, 2.887812e+10,  4.384194e-09,
        -2.936771e-11, -4.164448e+07, 3.391389e+04,  -3.923673e+17, -2.735518e-22, -2.019257e-01, 3.014806e+15,
        -3.885050e-15, -2.806241e-20, 3.077066e+18,  -1.574438e+14, -3.131588e+19, 4.812541e+03,  4.435881e+16,
        -3.843380e+02, -7.522165e+03, -3.668055e-21, 2.603478e-08,  2.928775e+08,  2.892123e+00,  -1.594119e+04,
        -4.817379e-01, -2.121948e+03, -8.872132e-09, -3.909318e-06, -3.849648e-14, -4.554589e+18, 4.410297e-15,
        -2.976295e-04, -2.298802e+10, 4.981337e-07,  5.364781e-12,  1.536953e+07,  -4.082889e-07, 1.670759e-21,
        4.009147e-13,  -4.691543e-18, -2.597887e-13, 2.368696e+18,  -2.585884e-07, -5.209726e-03, -2.568300e+06,
        2.184692e-20,  -1.799204e+16, 1.397292e+04,  4.277966e+13,  -4.072388e+09, -2.324749e+16, -4.717399e+10,
        -2.853124e-05, -3.664750e+11, -3.864796e-08, 3.265198e+07,  -3.309827e+19, 3.222296e+03,  2.366113e-19,
        -3.425143e+14, 1.627821e-08,  4.987622e+00,  -1.402489e-17, -1.303904e+15, -2.042850e+17, -1.399340e+09,
        -3.560871e+05, -4.251240e-21, -7.806581e-10, 1.723498e+00,  -2.030115e+08, 4.595621e-19,  1.174387e-10,
        3.474174e+14,  -4.159866e+03, -1.833464e-19, -3.650925e+05, 3.757361e-03,  -1.854280e-10, -1.856982e-13,
        1.685338e+08,  4.051670e-11,  4.095232e+03,  -2.956025e-16, 4.986423e-05,  4.941458e+10,  4.145946e+11,
        3.402975e+14,  -1.954363e+11, -2.274907e+10, -3.162121e-17, -5.027950e-07, 4.135173e-02,  -3.777913e-04,
        -4.898637e+15, 2.354747e-02,  -6.884549e+13, -1.896920e-05, -1.914414e+15, -1.196744e-19, -4.692974e-01,
        8.586675e-10,  -2.204766e-17, -3.586447e-14, 1.751276e+17,  -2.546189e-05, -2.248796e+03, -9.445830e+02,
        1.150138e+03,  4.586691e+11,  -2.582686e-15, -2.795788e+12, -3.409768e+07, -2.172186e-03, -1.457882e+06,
        -4.153022e+13, -4.255977e-08, 3.216237e-07,  4.935803e+02,  -4.248965e-16, 1.740357e+07,  4.635370e+19,
        -4.099930e-14, 2.758885e-16,  -4.714106e-05, -4.556226e-20, -4.290894e-19, 1.174284e-09,  -1.443257e+16,
        -2.279471e-08, -3.030819e-16, 1.535128e+18,  -3.248271e-07, 3.079855e-21,  -3.056403e-02, -1.368113e-12,
        4.004190e-10,  4.955150e+07,  -2.494283e-16, 2.186037e+05,  -1.232946e+03, 5.586112e-05,  -2.288144e+17,
        2.515602e-19,  -4.064132e+08, -3.217400e-02, -2.620215e+07, 2.283421e-14,  -1.130075e+08, 3.304955e-03,
        1.352402e+01,  6.255755e-03,  -3.913649e-08, 5.474984e+01,  -4.712294e-08, 3.548418e-16,  1.276896e+12,
        2.007320e-08,  3.025617e+04,  -2.544836e+14, -2.087825e+17, -3.285556e-09, 2.605304e+07,  -1.876210e+07,
        3.734943e-10,  -3.862726e-15, -4.227362e-05, 1.267773e+14,  -1.706991e-05, 3.737441e+10,  2.641527e+01,
        4.439891e+10,  -1.444933e-05, -2.190034e-12, 8.059924e-18,  -1.324313e+18, -1.420214e-10, 3.940158e-20,
        3.943349e-02,  -2.685925e+19, 4.334133e-05,  3.171371e-21,  2.094486e+12,  1.331741e+03,  1.205892e-02,
        1.791416e+04,  3.899239e+10,  6.581991e+06,  -3.860368e+11, -3.853916e-02, 1.314566e+09,  3.923126e+03,
        -3.509905e+13, -4.332430e+06, -1.713419e+01, -1.244104e-14, -5.529613e+01, 6.630349e+06,  1.053668e+10,
        3.312332e-05,  -1.252220e+08, 3.997107e-07,  1.847068e-13,  -2.393157e-11, -2.083719e-10, -4.927155e+11,
        2.666499e-15,  4.087292e-10,  4.082567e-10,  -2.017655e+07, 9.108015e+15,  -4.199693e-15, -4.969705e-17,
        1.769881e-02,  1.745504e+00,  2.200377e-16,  -4.404838e-06, -1.317122e-15, 7.210560e+08,  1.282439e-18,
        -3.204957e-06, -1.624277e+05, 4.570975e-22,  1.261776e+04,  4.416193e+12,  -4.343457e-18, 4.095420e-14,
        4.951026e-09,  2.261753e-15,  4.125062e+05,  -4.448849e+11, -3.184924e+06, -2.050956e+05, -9.895539e+09,
        4.541548e+11,  -4.230580e+11, -4.268059e-15, -4.393836e+09, -2.514832e-08, 3.322394e-04,  2.597384e-18,
        1.316619e-11,  -2.250081e+16, 2.179579e-10,  -1.838295e+04, -1.995626e-17, -4.656110e+17, 3.481814e-07,
        -2.859273e-11, -2.011768e-06, -1.809342e-17, -3.242126e+10, -1.873723e+08, -2.833009e-12, -3.758282e+12,
        2.970198e+15,  -2.667738e-01, -3.689173e+11, 1.008362e-10,  -1.526867e-20, -1.439753e+06, -6.154602e+16,
        4.165816e+00,  -1.597823e-09, -1.862803e+14, -2.222766e+15, -2.892587e+17, -4.230426e-14, 2.999121e-21,
        1.642245e+00,  1.590694e-14,  -4.469755e-06, 2.700655e+12,  -1.822443e-02, -4.889338e-16, -3.174990e-11,
        4.146024e-03,  1.313280e+01,  3.235142e+15,  3.500547e+00,  -4.413708e+03, 1.485548e+16,  -1.660821e-11,
        -4.334510e-22, -1.209739e+04, 1.149570e+12,  -4.537849e+00, -3.628402e-16, 2.748853e-12,  -4.818907e-21};
    EXPECT_RRARRAY_EQ(AttachRRArray(d2_b, 392, false), r->get_d2());
    double d3_a[] = {9.025110e-18, 3.567231e+17, 2.594489e+01, 2.311708e-04, 7.345164e+13, 6.550284e-01,
                     1.969554e+12, 9.451979e-05, 5.900637e-09, 9.975667e+03, 6.549533e-17, 2.227145e-13,
                     2.822132e+18, 4.332600e+18, 1.485466e+05, 5.844952e-14};
    EXPECT_NO_THROW(r->set_d3(AttachRRArray(d3_a, 16, false)));
    double d3_b[] = {2.047398e-20, 2.091541e-20, 9.084241e+14, 1.583413e+01, 5.168067e-02, 1.360920e-11,
                     9.818531e-21, 6.293083e+07, 4.406956e-14, 8.540213e-09, 7.329310e-03, 5.566796e+00,
                     3.968358e-08, 4.928656e-08, 5.994301e-20, 8.281551e-21};
    EXPECT_RRARRAY_EQ(AttachRRArray(d3_b, 16, false), r->get_d3());
    double d4_a[] = {-4.207179e-09, -3.611333e+11, -4.155626e-06, -2.458459e+10, 2.826045e-11,
                     3.511191e-08,  4.759250e-07,  2.455883e+09,  4.182578e+11,  4.732337e-14,
                     -2.967313e+02, -4.139188e+14, 6.287269e+03};
    EXPECT_NO_THROW(r->set_d4(AttachRRArray(d4_a, 13, false)));
    double d4_b[] = {2.864760e-08, 3.900663e+13, 9.105789e+11, 2.943743e-15, -2.823159e-16, -3.481261e+19};
    EXPECT_RRARRAY_EQ(AttachRRArray(d4_b, 6, false), r->get_d4());

    // multi dim arrays

    uint32_t d5_a1[] = {8, 6, 2};
    double d5_a2[] = {
        -5.528040e-08, 3.832644e-01,  -9.139211e-22, -4.919312e-05, 3.809620e-11,  1.751983e-09,  2.207872e-21,
        1.432794e+09,  -1.970313e+11, 3.405643e-18,  -3.756282e+14, -4.918649e+08, -3.162526e-14, -2.853298e-09,
        2.835704e+10,  4.458564e+16,  6.657007e+09,  3.640798e-10,  4.950898e-06,  3.384446e+14,  -4.065667e+16,
        -2.243648e-05, 4.822028e-21,  4.231462e-14,  -2.526315e+11, -5.626782e-05, 2.321837e+13,  1.772942e-09,
        1.606989e-08,  2.669910e-04,  -3.635773e+08, -3.967874e-10, 6.599470e+15,  4.612631e-08,  -1.417977e-11,
        -8.066614e-18, 5.738945e+15,  6.408315e+13,  1.922621e+12,  3.096211e-14,  -2.079924e+18, 1.664290e+09,
        -4.502488e+07, 3.092768e+05,  4.414553e+10,  -3.673268e+02, -4.772391e+17, -1.100877e+02, -1.453900e+01,
        4.293918e-13,  -4.270900e-02, -3.886217e+11, -2.206806e+02, 7.034173e-07,  -2.826108e-21, 3.616703e-21,
        -3.385765e+04, -7.027764e-11, 9.684099e+05,  -4.248931e+03, -3.415720e-20, -3.315237e-11, -9.555895e+11,
        3.520893e-13,  1.089514e-13,  3.591828e-21,  -4.847746e-06, -2.678605e-16, -7.480139e-04, 2.208833e+01,
        1.075027e-07,  -1.047160e-05, 2.309356e+06,  7.308158e-19,  -4.915658e+02, 4.634137e+18,  -3.682525e+13,
        4.124301e-06,  4.158100e-10,  2.091672e-11,  -6.856023e+07, 8.418116e-07,  -1.655783e-13, -2.502703e-03,
        1.274299e+17,  -4.784498e-20, 1.357464e-10,  4.107075e-13,  -2.753087e-05, -2.594853e-14, -3.712038e-13,
        1.143743e+14,  -2.495491e+10, 2.331111e-15,  2.987117e+18,  2.876066e-18};
    EXPECT_NO_THROW(
        r->set_d5(AllocateRRMultiDimArray<double>(AttachRRArray(d5_a1, 3, false), AttachRRArray(d5_a2, 96, false))));

    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > d5_2 = r->get_d5();
    uint32_t d5_b1[] = {5, 6, 5};
    double d5_b2[] = {
        4.427272e-10,  -1.149547e-08, -1.134096e+16, -4.932974e-03, -7.702447e-01, -3.468374e-03, -5.037849e-14,
        -4.140513e-08, 4.553774e+03,  2.746211e+01,  -4.388241e-17, 2.262009e+00,  5.239907e+06,  4.665437e-05,
        -1.662221e-05, 5.471877e-13,  2.592797e+11,  -4.109763e-05, 1.797563e-04,  1.654153e+01,  4.011197e+07,
        -2.261820e-10, 5.836798e+02,  1.518876e-18,  4.814150e+18,  -4.610985e-07, -3.126663e-07, -1.981883e+10,
        4.117556e-02,  1.937380e-07,  1.397017e-10,  2.809413e-17,  9.387278e+18,  4.777753e-11,  -4.248411e+15,
        3.851890e-16,  -1.598907e-08, 3.699930e+14,  2.763725e-08,  -4.130363e+17, 3.105159e+06,  -2.026574e+00,
        3.956735e+01,  3.893311e-04,  3.574216e+13,  3.618918e+03,  -4.027656e-09, 9.174470e-02,  -8.108362e-21,
        1.857260e-18,  -3.540422e+13, -2.985196e+12, -3.219711e-08, -1.618670e-13, -2.648920e+12, 1.224910e-14,
        -4.740355e-03, 4.604337e-18,  3.809723e+05,  -4.460252e+15, 1.894675e-15,  -4.141572e-08, -3.939165e-09,
        -1.916940e-06, -2.382435e+16, -4.689458e-01, 1.498825e+17,  1.876067e-15,  -1.801776e+09, -1.140569e-05,
        -6.881731e-08, -4.835017e-07, 3.843821e-17,  2.220728e+06,  -4.321528e+10, -3.950910e+01, -1.732064e-11,
        3.009556e-16,  -3.509908e+18, -7.781366e-15, -2.511896e-18, -2.037492e+04, 2.656214e-19,  2.163108e+16,
        4.526743e+19,  2.738915e-11,  8.491186e-16,  -1.286244e+05, 3.635668e+12,  -4.964943e+15, 3.725194e+05,
        -4.010695e-19, 2.140069e-09,  3.957374e+19,  4.478530e-06,  4.284617e-06,  -3.459065e+12, 1.525227e-18,
        4.892990e+06,  3.557063e+07,  2.986931e+18,  2.147683e-05,  -4.190776e+17, -3.715918e-14, -3.448233e+01,
        1.272542e+15,  -3.900619e-06, -3.712080e+05, 3.388577e+04,  -4.440968e-11, -4.395263e+18, -4.052174e-06,
        -3.065725e+00, 3.915471e-04,  4.863505e+12,  4.861871e-09,  4.607456e+03,  -1.845908e-12, -9.985457e-11,
        -4.534696e-08, -1.163049e-17, 4.492446e-11,  3.078345e+06,  8.520733e+05,  2.218171e+14,  -4.546400e+09,
        4.641295e+09,  -1.677260e-07, 9.650426e+04,  -4.001218e-04, 4.761655e-22,  -3.989865e+01, -5.800472e-08,
        -2.548565e-01, 4.648520e-08,  4.255433e-16,  -2.387043e-11, 4.172928e+17,  4.194274e-12,  -1.391555e-04,
        -1.063723e-01, 1.609824e-13,  9.196780e-10,  -4.744075e+06, -4.764303e-02, -4.540535e-10, -4.361282e+00,
        -1.460081e+01, -2.215205e-16, 4.652514e-19};
    EXPECT_RRARRAY_EQ(d5_2->Dims, AttachRRArray(d5_b1, 3, false));
    EXPECT_RRARRAY_EQ(d5_2->Array, AttachRRArray(d5_b2, 150, false));

    uint32_t d6_a1[] = {3, 3};
    double d6_a2[] = {-5.528040e-08, 3.832644e-01, -9.139211e-22, -4.919312e-05, 3.809620e-11,
                      1.751983e-09,  2.207872e-21, 1.432794e+09,  -1.970313e+11};
    EXPECT_NO_THROW(
        r->set_d6(AllocateRRMultiDimArray<double>(AttachRRArray(d6_a1, 2, false), AttachRRArray(d6_a2, 9, false))));

    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > d6_2 = r->get_d6();
    uint32_t d6_b1[] = {3, 3};
    double d6_b2[] = {4.427272e-10,  -1.149547e-08, -1.134096e+16, -4.932974e-03, -7.702447e-01,
                      -3.468374e-03, -5.037849e-14, -4.140513e-08, 4.553774e+03};
    EXPECT_RRARRAY_EQ(d6_2->Dims, AttachRRArray(d6_b1, 2, false));
    EXPECT_RRARRAY_EQ(d6_2->Array, AttachRRArray(d6_b2, 9, false));

    // Test various number types

    // floats
    EXPECT_NO_THROW(r->set_s1(3847.9283f));
    EXPECT_NO_THROW(EXPECT_FLOAT_EQ(r->get_s1(), 7.8573f));
    float s2_a[] = {
        -1.374271e+12f, 1.798486e-08f,  -4.845395e-08f, -4.785331e+12f, -2.914127e+04f, -1.753064e-17f, -4.063563e-09f,
        2.758058e+04f,  -1.988908e+11f, -1.535073e-18f, 2.439972e-02f,  -3.237377e-12f, 9.760366e-12f,  -4.276470e-21f,
        1.693848e+18f,  -1.401259e-19f, -3.140953e-11f, 8.675222e-05f,  -2.097894e+05f, -1.183071e+09f, -4.405535e-14f,
        -1.157335e+11f, 1.055748e-19f,  2.363738e+19f,  -1.404713e+19f, 4.284715e+01f,  -3.515661e+19f, -1.254196e+13f,
        2.076816e+19f,  -2.454920e+04f, -2.205493e-21f, -9.940678e+08f, 3.818785e+03f,  -1.504647e-14f, -2.604226e+15f,
        -3.708269e+10f, -1.633861e-19f, -2.928434e+06f, -3.741304e-01f, 3.925411e+09f,  1.135659e+05f,  8.774251e-11f,
        8.857955e-17f,  1.461853e-18f,  2.228531e+18f,  -2.901828e-21f, 2.648299e+17f,  -1.981382e-08f, -8.234543e-19f,
        -1.732653e+07f, 1.899980e+10f,  -1.392906e-08f, -6.839790e+14f, -2.267130e+09f, -4.215074e-14f, 4.329019e-17f,
        -3.351069e+09f, -2.689165e-07f, -4.337995e+10f, 4.010095e-15f,  1.340637e-05f,  -4.157322e-06f, -1.091954e+14f,
        1.108454e-11f,  -8.934548e+08f, -3.823683e+14f, -3.164062e+07f, 2.908637e-08f,  8.450160e+02f,  4.285117e+16f,
        -2.603674e+05f, -5.280737e-07f, -2.589230e-05f, -9.163516e+17f, -3.501593e+04f, -4.513991e+06f, 3.740032e+11f,
        6.325982e+08f,  4.911299e+19f,  -3.871696e-08f, -1.641252e+00f, -3.909808e-17f, 4.148389e-21f,  3.153334e-06f,
        -2.737137e-07f, -2.885790e-08f, -2.024930e+09f, 7.689509e+05f,  -7.910094e+00f, -3.122012e-08f, 2.087070e-07f,
        2.943975e-08f,  -3.637942e-05f, 1.265381e-18f,  -3.240420e-07f, -3.299393e+15f, -4.534857e+15f, -4.197434e+05f,
        2.443365e-06f,  -1.220755e-17f, 2.294507e+06f,  1.755297e-21f,  9.738120e-03f,  3.730024e+12f,  4.634193e+11f,
        -4.594819e-08f, -1.281819e-03f, 1.860462e-04f,  -3.678588e+18f, 4.460823e-18f,  -1.766008e+14f, -2.775941e+11f,
        4.325192e-07f,  2.655889e+10f,  -1.757890e-06f, -2.103859e-08f, -2.269309e+12f, -9.581594e-11f, -2.672596e+14f,
        -3.052604e+04f, -2.464821e+18f, -4.276556e+02f, -4.032948e+05f, -2.305644e+19f, 4.750717e-04f,  6.464633e+03f,
        7.776986e+17f,  -2.123569e+16f, 3.016544e-07f,  -2.520361e-03f, 2.920953e+00f,  3.216560e-12f,  -1.880309e+10f,
        9.663709e+16f,  1.981875e-02f,  1.826399e+19f,  -1.218763e-21f, 1.673439e-10f,  -1.995639e-05f, -2.134349e-02f,
        -3.101600e+11f, -1.148683e-14f, 1.527847e-11f,  -4.532247e+08f, 4.120685e-21f,  4.836973e+16f,  4.509629e-05f,
        3.936905e+17f,  -7.068550e+07f, 4.976433e+02f,  2.118027e+02f,  4.972063e+06f,  4.601005e+16f,  -4.367053e-17f,
        1.770987e+06f,  2.572953e+00f,  3.020633e+12f,  1.762052e+11f,  4.443317e-05f,  -1.896787e+08f, 3.349722e-14f,
        1.094784e+06f,  2.239828e+00f,  -1.400895e+05f, -1.098610e+09f, -3.681296e-09f, 2.842120e+16f,  3.138041e-18f,
        1.993332e+07f,  -2.584283e-06f, -4.399412e+12f, -7.050502e-19f, 1.079255e-10f,  2.938524e-19f,  4.733761e+07f,
        4.451092e+02f,  1.326299e-17f,  2.808418e+12f,  -2.952152e-14f, 4.550734e-16f,  -2.399796e-04f, -2.786184e+07f,
        -3.567595e+03f, -2.166879e+19f, -1.804263e+04f, -9.775023e+09f, 4.758856e+09f,  2.636609e+13f,  4.132205e+10f,
        2.594126e-20f,  -3.244046e-18f, -3.136448e-03f, -3.446778e+08f, 2.442233e-12f,  1.808183e-11f,  -2.846331e+02f,
        -2.933024e-10f, 3.547133e+00f,  -9.445332e-20f, -4.328694e-04f, 2.748924e-12f,  4.169152e+10f,  -3.488881e-04f,
        -2.713158e-08f, -1.549705e+15f, -3.554349e-08f, 2.503210e+14f,  1.715581e+08f,  -2.047344e-10f, -4.017695e+05f,
        -1.979563e-08f, 4.032794e+07f,  -1.670813e+07f, 1.889040e+07f,  4.875386e+11f,  -1.159781e+13f, -4.023926e-21f,
        4.535123e-07f,  4.470134e+02f,  -2.619788e+04f, -3.454762e-09f, 3.006657e+00f,  1.158020e-13f,  1.885629e-11f,
        -3.766239e+15f, -6.418825e-20f, 3.322471e+13f,  4.646194e-07f,  -2.817521e+13f, 1.370796e-04f,  4.014727e+04f,
        3.057565e+18f,  -6.171067e-12f, -4.067906e-16f};
    EXPECT_NO_THROW(r->set_s2(AttachRRArray(s2_a, 234, false)));
    float s2_b[] = {
        3.252887e+09f,  1.028386e-04f,  -2.059613e+01f, 1.007636e-14f,  -4.700457e-13f, -1.090360e-22f, -3.631036e-15f,
        2.755136e-09f,  4.973340e+13f,  2.387752e-15f,  -9.100005e+06f, 1.484377e+13f,  -2.287445e-13f, -3.718729e+18f,
        -4.771899e+19f, 8.743697e+13f,  1.581741e+07f,  2.095840e-09f,  -5.591798e-03f, 6.596514e-06f,  -1.006281e+05f,
        -4.126461e+12f, 4.246598e-20f,  -1.376394e+08f, -3.398176e-03f, -1.360713e-21f, 3.109012e+14f,  -8.112052e+07f,
        -8.118389e-02f, -3.455658e+14f, 7.352656e+12f,  4.198051e+06f,  4.258925e-03f,  -2.634416e+12f, 3.362617e+02f,
        -4.606198e-15f, 4.228381e-19f,  4.209756e-15f,  -1.268658e+05f, 3.019326e+02f,  7.937019e-01f,  6.225705e-09f,
        1.324805e-19f,  -4.355122e+01f, -4.533376e+15f, -1.584597e+01f, 1.657669e-02f,  -3.720590e-18f, 2.038227e-04f,
        2.890815e+04f,  1.513743e-14f,  4.993242e-20f,  -5.255463e-21f, -8.084456e-14f, 4.087952e-09f,  2.518775e-21f,
        4.977447e+15f,  3.363414e-19f,  -3.931790e-20f, -7.810002e+14f, -3.589876e+14f, -4.969319e-18f, -4.356951e-20f,
        -3.682676e+02f, -1.319524e+10f, 3.805770e-11f,  2.134369e-10f,  3.684259e-08f,  -2.901651e-13f, -4.486479e-01f,
        2.208715e-02f,  3.224455e-01f,  -3.305078e+09f, -3.326595e-02f, -2.473907e+03f, 3.608010e-15f,  -2.596035e-01f,
        2.594405e-01f,  -7.569236e-01f, -3.430125e+09f, 2.920327e+02f,  -3.763994e-12f, 2.617484e-12f,  4.808183e-07f,
        3.885462e+15f,  -1.201067e+00f, 1.887956e+06f,  -4.038215e+02f, -4.710561e+03f, 1.659911e-16f,  -4.955908e-17f,
        4.681019e-09f,  3.945566e+05f,  -3.433671e+19f, -2.679188e+05f, -2.357385e-01f, 2.891702e-19f,  -4.464828e-06f,
        -6.003872e-04f, 1.369236e+18f,  -3.597765e+01f, -4.246195e+08f, -4.765202e+17f, 4.472442e+10f,  -1.038235e-05f,
        -4.632604e-09f, -2.484805e-15f, -7.998089e-16f, -3.690202e-04f, -3.276282e-04f, 1.966751e+10f,  -5.081691e-18f,
        -2.004207e-05f, -2.756564e-03f, -2.624997e+14f, 2.398072e-20f,  -4.098639e-10f, 2.930848e+01f,  8.983185e+15f,
        1.984647e-15f,  1.331362e-16f,  -6.519556e+15f, 4.270991e+15f,  -9.165583e-13f, 4.266535e+17f,  4.238873e-21f,
        -2.487233e+17f, 4.904756e+03f,  2.692900e+10f,  1.467677e-18f,  -2.204474e+06f, -1.806552e-09f, 9.617557e+17f,
        -1.988740e-20f, 1.713683e-04f,  -2.360154e-21f, 4.178035e-17f,  2.600320e+12f,  -4.761743e+09f, 3.034447e-20f,
        4.941916e-06f,  -1.373800e+04f, 1.851938e-09f,  1.304650e+14f,  3.067267e+07f,  -4.100706e-06f, 2.190569e-03f,
        5.901064e-17f,  -2.152004e+15f, 4.050525e+04f,  3.769441e-06f,  -4.388331e-12f, 1.037797e+12f,  3.512642e-19f,
        3.857774e-09f,  1.036342e+03f,  3.683616e-18f,  9.785759e+10f,  2.199992e+03f,  -2.435347e-02f, 1.526312e+06f,
        2.569847e+14f,  -2.288773e-01f, 4.724374e-06f,  -3.807381e+13f, 2.924748e-10f,  2.820652e-20f,  4.835786e-12f,
        2.811112e+02f,  -6.431253e+02f, -4.843622e-06f, 1.676490e-10f,  -4.432839e+07f, 1.661883e+19f,  8.668906e+07f,
        2.256498e-04f,  2.170563e-01f,  1.013347e-17f,  -4.271306e+11f, -2.431836e-17f, 3.983056e+02f,  4.236306e+05f,
        -2.142877e-20f, -2.760277e-12f, -8.479624e-08f, 2.903436e+05f,  -3.288277e-17f, 4.173384e-10f,  -1.598824e-08f,
        8.702005e+05f,  -1.456065e+08f, 2.035918e+06f,  -1.445426e+02f, -4.148981e+05f, 4.439242e+02f,  -1.223582e+16f,
        -8.226224e+14f, 1.690797e+16f,  1.683472e-04f,  -4.809448e-16f, 4.517499e+06f,  4.369645e+02f,  -4.532906e+09f,
        -3.539758e+07f, -2.406254e+01f, 4.396602e+00f,  2.995832e-01f,  -2.953563e-04f, 3.412885e+17f,  1.386922e-17f,
        -2.177566e-04f, 2.548426e+04f,  -3.937000e+16f, 2.578962e+02f,  2.423257e+16f,  3.069379e+09f,  -4.940417e+09f,
        -4.618109e-13f, -1.387521e-11f, -2.168721e-05f, 1.917758e-01f,  -3.144071e+03f, -1.045706e-13f, -2.869528e+02f,
        2.072101e-13f,  4.267714e+12f,  -2.063457e-19f, -3.025547e-12f, 8.101894e+10f,  -4.196343e-04f, 4.753178e+18f,
        -2.286673e+08f, -2.618986e-10f, 3.949400e-10f,  -4.390776e+12f, -2.498438e+10f, 3.800599e+12f,  -3.704880e+15f,
        -4.173265e+02f, 3.326208e+19f,  -1.093729e-21f, 3.042615e+16f,  -1.711401e-09f, 3.039417e-19f,  -2.250917e+15f,
        2.195224e-01f,  -2.953402e+05f, -1.486595e+17f, -2.387631e+00f, -1.634038e-14f, 6.153862e-18f,  -3.842447e+05f,
        3.238062e-14f,  -4.341436e-11f, -1.816909e-19f, -3.534227e+14f, 8.578481e+07f,  -4.067319e+09f, -4.680605e-08f,
        4.050820e+04f,  1.715798e-11f,  -5.232958e-12f, 2.291111e-07f,  1.086749e+01f,  -3.028170e-14f, -6.277956e+13f,
        -1.639431e+11f, 4.158870e+17f,  -1.208390e-18f, 4.835438e-05f,  -3.135780e-08f, -4.087485e-12f, 2.466489e-08f,
        1.949774e+00f,  -3.532671e-21f, -1.422500e+12f, 4.352509e+03f,  -1.444274e-17f, -1.162523e+19f, -4.815817e-07f,
        -2.809045e+11f, -1.212605e+03f, -3.496461e-08f, 6.743426e-18f,  -4.226437e-06f, -3.627025e+07f, 1.037303e-05f,
        2.411375e+08f,  -2.721538e+12f, -4.809954e-06f, 4.578909e+16f,  9.257324e+06f,  4.326725e-03f,  4.416348e+12f,
        4.424289e+13f,  3.180453e+12f,  -6.028285e-10f, 3.344767e-14f,  -2.747083e+18f, 1.133844e-15f,  3.922737e-06f,
        -3.199165e+00f, 2.417553e+02f,  3.015159e-20f,  2.119116e-02f,  4.019055e-09f,  3.368508e-21f,  -1.613240e-19f,
        3.832120e-14f,  1.202460e+17f,  -3.304317e+19f, 1.692435e+17f,  -2.597919e-05f, 3.916656e+17f,  4.821767e+06f,
        4.372030e+02f,  1.987821e-08f,  -1.976171e-08f, 1.319708e-09f,  -4.213393e+10f, 3.829773e-15f,  -4.762296e-21f,
        4.642216e-18f,  1.662453e-13f,  6.642151e+03f,  2.539859e-02f,  -3.112435e+09f, -3.627296e-20f, -1.660860e+02f,
        -3.678133e+07f, 3.428538e-01f,  -2.277414e-20f, 2.228723e+17f,  -2.833075e-06f, 9.084647e+03f,  -2.976724e-16f,
        2.778621e+15f,  -2.806941e+07f, -1.626680e-15f, -4.658307e+13f, 7.967425e-11f,  -2.793553e-21f, 4.778914e+16f,
        -6.145348e-21f, -4.883096e+11f, 1.338180e+04f,  7.533078e-16f,  3.252210e+05f,  -2.882071e+10f, -2.754393e-06f,
        -1.689511e-16f, -1.979567e-10f, 4.494219e-04f,  3.285918e-15f,  -4.347530e+05f, -1.085549e+15f, 1.301914e+07f,
        3.855885e+13f,  3.036668e-11f,  -4.706690e+12f, 3.727706e+17f,  -4.446726e-12f, -4.829207e-08f, -1.543068e-10f,
        -2.473439e-11f, -2.718383e+13f, -4.211115e-21f, 3.327305e-04f,  -1.084328e-20f, 3.849147e+06f,  -1.321415e+09f,
        -3.518365e+07f, 2.246762e-21f,  2.482377e+11f,  -4.265765e+03f, -4.538240e-05f, 2.727905e+18f,  -2.383417e-13f,
        4.103955e+04f,  8.015918e-06f,  -2.965433e-18f, 3.156148e+03f,  8.093784e+18f,  4.868456e-12f,  1.048517e-02f,
        1.112546e-19f,  -3.751041e-12f, -3.734735e-06f, 3.019242e+06f,  -1.480620e-17f, -3.405209e+07f, -1.123121e+19f,
        8.155940e-20f,  1.406270e-17f,  2.154811e-13f,  9.943784e-20f,  1.523222e-17f,  6.987695e-21f,  8.826612e-12f,
        -2.325400e-20f, 3.700035e+15f,  -5.559864e-11f, -8.568613e+10f, 1.434826e-07f,  -2.080666e-03f, -2.548367e-03f,
        -4.310036e-18f, 3.104310e+00f,  -3.862149e+17f, -4.092146e-13f, 3.538555e-14f,  -4.950494e-05f, 6.538592e-13f,
        -4.196452e-11f, 2.351540e-01f,  -1.232819e-01f, -3.669909e-21f, 1.528733e-14f,  5.661038e-15f,  -1.967561e-07f,
        -2.284653e+02f, -1.834055e-10f, -2.175838e+05f, 4.247123e+06f,  1.184396e+18f,  4.156451e+15f,  -4.992962e-14f,
        -2.351371e+06f, -6.698828e-10f, 2.897660e+17f,  -3.470945e-06f, 4.630531e-07f,  -4.453066e+10f, 4.069905e+09f,
        -4.459990e-08f, 4.702875e-13f,  -2.780085e+17f, 1.293190e-05f,  2.227539e-03f,  1.534749e-21f,  7.390197e-02f,
        4.522731e-10f,  -1.224482e-02f, -3.996613e+02f, -1.057415e-15f, -7.371987e+14f, 4.291850e-02f,  -4.243906e-08f,
        -3.540067e-04f, 4.535024e+09f,  -3.027997e+10f, -3.986030e-02f, 1.722268e-04f,  -3.140633e-20f, 3.343419e+08f,
        4.713552e+14f,  -3.190084e+05f, 2.449921e-01f,  2.727707e+14f,  -3.545034e+11f, 2.417031e+13f,  -2.231984e-09f,
        3.533907e+16f,  -4.662490e+16f, 3.355255e+14f,  -1.567147e+17f, -3.525342e+12f, -3.586213e-16f, -4.002334e+15f,
        -1.928710e+08f, -4.718466e+04f, -1.539948e-06f, 3.135775e-11f,  3.862573e-10f,  -3.105881e+08f, 4.421002e-05f,
        -2.369372e+01f, 4.758588e+13f,  -1.044237e-15f, -4.535182e-10f, 1.330691e+18f,  3.636776e-01f,  -4.068160e-12f,
        2.757635e-17f,  3.247733e+13f,  1.247297e+06f,  5.806444e-13f,  3.521773e-05f,  4.589556e-14f,  1.582423e+00f,
        -1.676589e+00f, -3.864168e-07f, -3.042233e-02f, 2.007608e+14f,  4.852709e+02f,  -2.817610e-04f, -1.882581e+19f,
        1.057355e-14f,  4.090583e-04f,  -1.848867e-13f, -5.463239e+13f, -1.041751e+05f, 3.457778e-01f,  -2.562492e+00f,
        -6.751192e-10f, 1.688925e-21f,  3.884825e-07f,  1.592184e-12f,  -2.039492e+06f, -1.196369e+19f, 2.200758e+00f,
        2.550363e-21f,  7.597233e+06f,  -1.929970e+09f, 1.939371e+03f,  -3.236665e+09f, -1.313563e-13f, 2.007932e+02f,
        -3.028637e-02f, -1.532002e+00f, 2.165843e+17f,  -3.511274e-04f, -3.777840e+15f, 1.645100e+17f,  3.088818e-07f,
        -2.793421e-11f, -4.286222e-01f, 4.385008e-10f,  -2.105222e-01f, -2.212440e+08f, 2.684288e-01f,  1.407909e+18f,
        -3.881776e+08f, 3.505820e-09f,  3.555082e-19f,  3.573406e+01f,  4.042915e-19f,  2.066432e+08f,  -2.467607e+10f,
        3.453929e+01f,  4.297309e-14f,  1.256314e-11f,  8.930289e+14f,  -3.662200e-03f, 2.075690e-16f,  -2.866809e-17f,
        4.394016e+10f,  -2.014195e-03f, -3.738633e+12f, -4.953528e-05f, 3.710240e+06f,  3.319208e+04f,  -5.762511e-20f,
        -4.690619e+16f, 3.412186e+19f,  -1.241859e+09f, -4.081991e+12f, 4.622142e+03f,  -1.285855e-02f, 1.532736e-08f,
        -2.364101e+09f, -1.369113e-18f, -2.168979e+19f, 2.952627e-14f,  -2.358172e-16f, -1.992288e+00f, -9.180203e+12f,
        1.675986e+07f,  4.817708e+06f,  -1.624530e+06f, 4.857415e-01f,  -5.995664e-03f, 1.874911e+08f,  -3.320425e-17f,
        5.469104e-02f,  -3.069767e+11f, 8.084999e+12f,  -2.321768e-20f, 1.920249e-06f,  -4.114087e-02f, 3.244903e-04f,
        3.203402e-17f,  4.143519e+06f,  4.093124e+17f,  4.456464e-15f,  -2.262509e-13f, 4.856535e-08f,  -4.550552e-15f,
        -3.011803e+18f, -2.882488e+13f, -2.690616e-04f, -3.996010e-19f, -4.438855e+18f, -1.942208e+03f, 1.934537e+18f,
        -1.961547e-07f, 4.970021e+17f,  -3.531211e-17f, 4.187133e+04f,  2.854106e-12f,  -2.313257e+13f, -3.471439e+16f,
        -6.829753e-16f, -4.338617e+03f, 5.552258e+05f,  1.520718e+19f,  -2.527013e+14f, -2.732660e-09f, -1.957740e+11f,
        -4.767907e+12f, -4.837256e+18f, 3.155432e-12f,  -3.278156e-04f, -1.117720e-13f, -3.838176e+11f, -7.207202e+08f,
        -4.075808e-21f, 1.659402e-14f,  -4.301886e-19f, -4.461337e-11f, 2.200979e+15f,  4.339143e+07f,  5.071459e-06f,
        1.832776e+18f,  -2.698948e+03f, 4.682397e+01f,  2.801081e-08f,  -3.424292e+00f, -5.130555e+14f, 1.229975e-14f,
        2.383361e-09f,  -3.611087e-07f, -2.576595e-07f, 1.295398e-08f,  -2.525216e-11f, -2.546657e+10f, 9.501518e+03f,
        8.325605e+04f,  -1.382092e+02f, 2.169085e-21f,  4.019485e+16f,  -2.404251e+17f, 1.154833e+10f,  9.454498e+01f,
        -7.888753e-09f, -4.907318e-20f, 1.373262e+08f,  -2.295105e-21f, 1.329034e+17f,  -3.403883e-20f, 3.500734e-03f,
        2.657397e-20f,  4.956090e-07f,  -2.191353e-03f, -1.879262e+09f, 4.519858e-14f,  4.592234e-14f,  -1.473612e+11f,
        4.425251e+10f,  -3.936903e-01f, -2.866089e+09f, -3.046203e-09f, -4.818832e+01f, 2.460150e+02f,  2.944622e-11f,
        -1.675111e-20f, -1.206111e+01f, 5.044200e-13f,  3.225861e+02f,  3.170008e+12f,  1.964043e-20f,  3.464033e+03f,
        1.286135e-08f,  -6.425529e-10f, -4.630162e-02f, 2.616476e+18f,  4.853669e+03f,  -1.851316e-03f, 1.262159e-02f,
        -1.816675e-12f, 3.753560e+14f,  -3.033601e-18f, 1.915137e-02f,  3.411614e-14f,  4.849348e+05f,  3.033922e+13f,
        3.174852e-17f,  -4.397997e-09f, -9.549484e-01f, -1.706859e+11f, -3.009122e-01f, -8.189854e-15f, 4.122789e-17f,
        -1.351025e-13f, -2.365671e-10f, -1.139709e-05f, -2.020593e+10f, 3.664729e+14f,  1.170917e+00f,  1.157248e-19f,
        -4.189734e+17f, -4.407278e+13f, 4.776929e+18f,  -3.279961e+07f, -4.740186e-15f, -3.764392e-02f, -2.193781e+18f,
        -4.556987e+00f, -3.170243e-18f, -1.755775e-16f, -2.163959e-03f, 2.410150e+11f,  1.215874e-18f,  -4.927956e-05f,
        2.252375e-06f,  -3.315242e-14f, -3.476357e+16f, -4.545391e+00f, 6.072704e-13f,  -4.571860e+09f, -2.297081e-02f,
        2.401997e+10f,  -6.449709e+05f, -3.580234e-08f, -5.390535e+08f, -4.891390e-19f, 3.441769e-09f,  4.885513e-09f,
        -4.897531e-10f, -1.792753e+08f, 2.048965e+13f,  3.339876e-21f,  4.140957e+04f,  2.022520e-21f,  5.983159e+06f,
        1.938164e+13f,  2.796107e-19f,  -1.975692e+09f, -2.106710e+15f, -4.482226e+09f, -2.968068e-19f, -1.171747e-03f,
        1.579378e-01f,  -4.568752e+16f, 2.593340e+11f,  3.441530e+10f,  3.461992e-01f,  -5.333082e-09f, -4.611969e-12f,
        -4.262468e+19f, -4.367063e+01f, -2.447378e-11f, -3.554859e+02f, 4.824680e-05f,  -1.122071e+11f, -2.226371e+13f,
        3.917182e-17f,  -1.308204e+10f, 4.105055e-16f,  5.087060e+07f,  7.102691e-05f,  -2.872202e+03f, 1.711266e+11f,
        3.331993e-08f,  -1.313944e-08f, 3.648109e+11f,  5.394321e+01f,  -4.125398e+03f, 3.460645e-02f,  2.573745e-18f,
        -1.376298e+01f, -3.283028e-05f, 3.939711e-12f,  3.986184e+17f,  2.619889e-11f,  -4.318052e-09f, 1.410821e+00f,
        3.547585e-07f,  4.046432e-17f,  1.880087e-07f,  1.867841e-05f,  -1.383592e-21f, 2.972106e-05f,  2.867092e+01f,
        3.092781e+03f,  -6.897683e-02f, -1.707761e-04f, -4.231430e-11f, -3.796784e+00f, -2.953699e+11f, 3.691013e+09f,
        -3.962307e-12f, -1.335633e-17f, -1.759192e-01f, -4.332862e+04f, 1.044899e+11f,  -2.126883e+03f, 1.948593e+14f,
        -2.173759e-05f, -4.393250e+05f, 1.626217e+08f,  2.832086e+18f,  4.655433e+03f,  2.944186e+08f,  2.864233e+03f,
        -3.565216e+05f, -4.667000e+11f, -3.739551e-03f, 3.137195e+05f,  2.044129e+19f,  2.629232e+14f,  3.119859e-09f,
        3.656121e-15f,  -4.844114e-03f, -2.641449e-11f, -3.788231e+05f, 2.803203e+17f,  -3.764787e+09f, -6.009761e-08f,
        4.106308e+01f,  -2.071363e-20f, 1.884576e-20f,  2.654081e+11f,  -3.456281e-11f, -4.760486e-02f, 4.096057e+11f,
        4.346738e-11f,  2.827941e-02f,  -1.946717e+08f, -9.067051e+15f, 4.331454e-14f,  4.792779e-09f,  -4.738308e+18f,
        -1.228815e-09f, 2.097152e+16f,  -4.440036e-06f, -3.762990e+02f, -2.642879e+12f, 3.100004e+10f,  3.604336e+12f,
        -3.951650e+11f, -1.023763e+15f, 4.908325e+17f,  2.123963e-19f,  -1.744445e+09f, -2.874189e-06f, 2.208907e-08f,
        -2.353407e+10f, -1.020581e-03f, 1.689180e-01f,  -2.563565e-12f, -1.220758e-15f, -2.657970e-16f, 1.140528e+10f,
        -2.802143e+14f, -3.835574e+00f};
    EXPECT_RRARRAY_EQ(r->get_s2(), AttachRRArray(s2_b, 856, false));

    // int8
    EXPECT_NO_THROW(r->set_i8_1(45));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_i8_1(), -66));
    int8_t i8_2a[] = {
        -66,  34,   -121, -118, -12,  -83,  -43,  55,   -53, 31,   -100, -37,  -116, 69,   22,   -60,  59,   32,   51,
        46,   109,  36,   31,   49,   -99,  -69,  -99,  -89, 27,   -18,  -77,  -63,  -101, -122, -60,  58,   -76,  -86,
        58,   49,   48,   -67,  54,   48,   -30,  -26,  95,  42,   -13,  17,   -93,  -34,  28,   -49,  8,    122,  22,
        -72,  109,  103,  15,   -81,  -73,  -53,  -112, -52, -54,  -81,  -126, 35,   3,    -102, -125, 67,   125,  44,
        -48,  95,   -18,  -103, 114,  -86,  108,  -37,  70,  48,   7,    19,   0,    35,   -104, 2,    -51,  -9,   70,
        41,   118,  -43,  -71,  59,   32,   36,   -10,  -2,  -76,  -18,  -93,  -80,  -27,  -51,  -70,  -87,  48,   -98,
        5,    72,   -120, 86,   62,   69,   -94,  23,   71,  -124, -88,  34,   -65,  6,    33,   73,   -101, 40,   -104,
        17,   -68,  53,   -55,  -11,  12,   24,   -63,  121, 98,   58,   125,  -13,  6,    49,   71,   -72,  -22,  53,
        83,   -97,  87,   -117, -26,  6,    93,   -98,  82,  -111, -84,  23,   -73,  -10,  -34,  -118, 64,   -89,  -4,
        -104, -83,  -52,  8,    64,   -81,  33,   -91,  41,  -43,  12,   -66,  31,   -17,  46,   91,   9,    -124, -117,
        108,  -15,  -39,  -92,  29,   116,  -93,  107,  58,  -7,   -35,  -116, -52,  -11,  -35,  66,   6,    32,   -34,
        -123, -102, 102,  123,  -104, 51,   80,   -84,  71,  -65,  -4,   -121, 123,  -87,  -21,  -124, 63,   122,  74,
        -31,  123,  -31,  -63,  -106, -82,  -24,  -42,  -30, -126, 0,    -38,  127,  -13,  101,  60,   104,  54,   -25,
        50,   -19,  -93,  2,    -48,  99,   -59,  103,  28,  44,   -7,   -58,  -19,  -55,  17,   58,   15,   -23,  75,
        58,   11,   -2,   104,  -58,  -73,  56,   84,   34,  -4,   -101, 10,   -106, 41,   -88,  15,   -117, 5,    -63,
        -106, -9,   40,   -115, 47,   99,   -66,  120,  126, 5,    -62,  8,    -111, 123,  92,   122,  24,   -31,  -65,
        115,  -43,  5,    56,   49,   102,  -29,  65,   97,  20,   -90,  -39,  40,   75,   -43,  -47,  86,   -104, -32,
        -90,  14,   13,   -75,  8,    -9,   104,  122,  -24, 77,   10,   -100, 26,   0,    35,   55,   -10,  17,   22,
        -29,  115,  117,  -10,  -54,  37,   46,   48,   -28, -105, 20,   -117, 73,   93,   -63,  9,    -125, -94,  57,
        119,  -10,  11,   49,   -57,  -14,  -107, 90,   72,  96,   55,   86,   81,   -86,  -70,  -125, 17,   100,  -91,
        -70,  87,   29,   100,  -19,  -45,  46,   25,   -49, 79,   -10,  -1,   22,   75,   9,    -50,  114,  106,  -122,
        -89,  41,   1,    105,  123,  -69,  -123, 77,   -61, -100, 15,   -113, -19,  46,   -53,  46,   -89,  -97,  -38,
        92,   73,   68,   -101, 118,  67,   23,   -17,  73,  109,  36,   76,   69,   -10,  7,    64,   -39,  -49,  -4,
        3,    -102, -15,  117,  -8,   -83,  6,    117,  105, 26,   28,   19,   66,   24,   -47,  -64,  86,   4,    57,
        95,   23,   24,   76,   -15,  106,  -58,  77,   -10, -112, -39,  55,   -4,   95,   -90,  61,   64,   32,   68,
        -43,  -108, -15,  -6,   63,   -105, 72,   -84,  -10, -11,  122,  46,   -84,  26,   76,   -88,  -67,  -95,  10,
        10,   -89,  -121, -65,  -69,  112,  37,   -106, 75,  -94,  -60,  -7,   -72,  44,   71,   -108, -71,  31,   99,
        9,    10,   -68,  -56,  69,   0,    -71,  -4,   -87, -6,   83,   7,    108,  98,   -37,  -60,  16,   23,   26,
        3,    -119, -20,  58,   102,  29,   111,  -43,  26,  37,   34,   9,    82,   76,   120,  7,    51,   -35,  65,
        -93,  38,   -82,  -44,  -31,  120,  -93,  7,    10,  -76,  -12,  105,  41,   13,   123,  -90,  57,   84,   -123,
        -21,  49,   104,  -103, -32,  -79};
    EXPECT_NO_THROW(r->set_i8_2(AttachRRArray(i8_2a, 576, false)));
    int8_t i8_2b[] = {
        -106, -119, 126,  87,   95,   79,   -1,   -15,  -4,   -30,  76,   -121, 35,   80,   5,    7,    -36,  102,
        120,  105,  86,   98,   113,  -62,  105,  38,   93,   20,   92,   7,    -99,  -121, -56,  50,   -35,  -95,
        2,    -43,  -49,  73,   49,   -42,  -24,  -3,   -41,  -59,  119,  -108, 82,   98,   95,   111,  114,  115,
        109,  -125, -60,  -45,  -110, 31,   -73,  -111, 69,   -108, -125, 14,   -87,  61,   114,  -104, -72,  -67,
        35,   26,   61,   59,   -114, 125,  -82,  -34,  7,    71,   -117, 125,  79,   -116, -81,  3,    -59,  -121,
        112,  64,   54,   -9,   -63,  37,   -86,  104,  -105, 7,    72,   -99,  84,   -3,   -63,  77,   27,   36,
        52,   -110, 60,   -119, -124, 82,   -29,  107,  124,  105,  96,   -34,  -11,  0,    59,   -39,  -107, 55,
        95,   -26,  -60,  -30,  -102, -94,  -28,  -7,   76,   56,   -31,  -68,  6,    101,  67,   101,  -92,  120,
        105,  -119, 114,  6,    9,    43,   73,   -64,  -18,  -77,  -72,  84,   -101, -114, -50,  28,   86,   103,
        -83,  -109, -59,  82,   96,   -70,  20,   75,   -44,  -3,   -115, 60,   45,   94,   65,   -108, 2,    12,
        28,   110,  -19,  20,   102,  -41,  42,   -61,  -52,  -54,  116,  114,  -74,  14,   -21,  -43,  -85,  16,
        57,   -62,  -83,  -79,  85,   -7,   109,  -45,  102,  28,   123,  -96,  2,    -37,  -19,  104,  4,    -43,
        -92,  -114, 34,   44,   29,   -96,  -99,  -95,  -101, 12,   18,   107,  125,  114,  -65,  126,  -28,  114,
        -2,   9,    79,   69,   67,   78,   -26,  -95,  109,  -81,  22,   -61,  84,   -16,  -84,  57,   8,    -88,
        -124, 119,  8,    35,   -56,  -14,  -90,  -73,  118,  -4,   -93,  35,   -76,  6,    -41,  98,   -69,  -108,
        -78,  16,   -72,  43,   -113, 71,   -70,  -51,  -41,  62,   -38,  -58,  58,   -127, 117,  67,   51,   34,
        -98,  -13,  -111, 13,   2,    -101, -75,  -22,  34,   42,   -93,  -106, 90,   -65,  -65,  -82,  55,   -111,
        -28,  -114, 54,   0,    39,   -46,  19,   78,   75,   -116, 64,   -120, -81,  -116, -96,  -36,  101,  67,
        -96,  14,   76,   74,   29,   67,   101,  68,   -83,  62,   86,   -64,  -76,  -87,  8,    44,   -61,  31,
        65,   -120, 3,    -82,  127,  105,  114,  -58,  -117, 52,   -104, 117,  23,   4,    -79,  -44,  -113, -65,
        52,   83,   39,   -120, 36,   -80,  104,  46,   12,   -61,  104,  99,   4,    53,   36,   91,   115,  -8,
        -32,  -111, 53,   6,    70,   -70,  108,  -68,  119,  -3,   -40,  110,  -15,  -94,  23,   36,   -39,  -87,
        96,   -89,  -73,  119,  117,  -45,  -119, 48,   -70,  -28,  -22,  -127, -16,  -56,  -75,  72,   59,   54,
        -15,  -57,  -113, 78,   -24,  63,   118,  74,   -62,  -101, 62,   -123, 28,   0,    -9,   30,   115,  47,
        86,   88,   -58,  91,   103,  121,  81,   -78,  80,   -50,  -13,  33,   92,   107,  -79,  55,   -89,  34,
        -121, 82,   -105, 59,   73,   59,   119,  72,   -26,  -122, 1,    41,   62,   -11,  -41,  101,  -101, 79,
        27,   -73,  -90,  -2,   -96,  10,   116,  -86,  -25,  -117, -36,  13,   -52,  90,   -39,  113,  -105, 71,
        -7,   2,    109,  106,  70,   -86,  -82,  -121, 94,   58,   13,   -124, 119,  34,   36,   -37,  47,   23,
        -101, -96,  -114, -37,  -21,  -37,  -77,  121,  -43,  25,   -105, -6,   5,    3,    -114, 30,   -98,  -74,
        -97,  -43,  16,   -84,  -44,  -56,  1,    -115, -100, -46,  -63,  -100, 112,  -106, -128, -2,   -106, -116,
        -1,   -43,  -24,  -73,  -124, 14,   69,   -90,  83,   -85,  -103, 52,   22,   58,   -90,  77,   -121, 110,
        20,   114,  -107, 102,  -76,  -6,   -102, -38,  53,   -100, -72,  118,  -100, -113, 120,  53,   -93,  61,
        -92,  -84,  -125, 81,   127,  125,  -8,   99,   70,   -49,  -9,   86,   103,  -96,  -96,  -40,  43,   -48,
        29,   28,   90,   45,   -118, 111,  -101, 24,   -25,  123,  -105, 124,  17,   27,   -6,   111,  -113, 21,
        -88,  -117, 55,   -7,   -24,  -24,  52,   39,   -36,  -81,  78,   95,   13,   121,  -8,   116,  -106, 45,
        -49,  19,   12,   13,   -127, 109,  -124, 14,   18,   84,   -61,  23,   68,   -102, 115,  -34,  7,    -10,
        57,   107,  -48,  -53,  -67,  -63,  -100, -84,  -31,  79,   -58,  56,   89,   40,   63,   -37,  71,   -7,
        -53,  91,   -66,  -74,  -37,  48,   -37,  123,  -96,  -11,  -56,  80,   -88,  -53,  27,   7,    -29,  -124,
        -46,  22,   -103, -67,  93,   42,   -37,  18,   -126, 120,  -81,  74,   26,   -54,  19,   86,   -112, -38,
        -57,  119,  26,   -62,  -67,  126,  -50,  -31,  -36,  120,  -127, 123,  -88,  43,   50,   61,   94,   -80,
        35,   41,   -109, 71,   91,   -118, 66,   -60,  -127, 47,   75,   -52,  -66,  -125, -111, 44,   116,  9,
        68,   115,  113,  8,    -4,   39,   23,   54,   107,  -119, 1,    -68,  -11,  103,  -123, 29,   -92,  15,
        -10,  -31,  35,   -91,  38,   37,   110,  9,    80,   -115, -120, 112,  110,  -28,  -116, 63,   85,   -65,
        5,    122,  19,   -84,  97,   -16,  -46,  97,   104,  28,   -83,  -33,  38,   -18,  -8,   -126, 82,   81,
        88,   109,  118,  -56,  64,   -96,  36,   -10,  -109, 74,   -86,  105,  123,  110,  -116, 91,   15,   123,
        -26,  -121, 75,   63,   24,   94,   -43,  123,  74,   79,   -42,  74,   -102, 57,   -27,  116,  126,  -100,
        2,    49,   17,   28,   27,   -58,  -98,  39,   50,   -66,  -75,  -23,  -112, 64,   -16,  60,   -62,  122,
        53,   -42,  21,   -40,  88,   2,    62,   -103, 108,  -74,  -95,  113,  -49,  -73,  63,   94,   44,   -41,
        -68,  -124, 46,   13,   -17,  11,   -100, 58,   -98,  -40,  -64,  -56,  21,   -47,  -120, -7,   -23,  -51,
        27,   -99,  -42,  -109, -55,  106,  92,   110,  19,   32,   -117, 4,    -34,  65,   72,   -100, -122, -69,
        -94,  122,  60,   23,   -93,  -84,  30,   118,  -92,  88,   -104, 23,   -71,  115,  106,  -118, 9,    64,
        -34,  -71,  43,   -92,  -13,  -82,  -5,   15,   18,   -11,  -113, -109, -128, 104,  34,   72,   -110, -59,
        -113, 69,   -106, -74,  -66,  115,  -31,  -27,  59,   -73,  73,   120,  -34,  59,   126,  -93,  49,   -53,
        114,  -122, -28,  -28,  94,   -37,  -90,  -32,  80,   15,   4,    -101, -78};
    EXPECT_RRARRAY_EQ(AttachRRArray(i8_2b, 967, false), r->get_i8_2());

    // uint8
    EXPECT_NO_THROW(r->set_u8_1(232));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_u8_1(), 222));
    uint8_t u8_2a[] = {
        52,  40,  13,  185, 137, 3,   173, 236, 60,  18,  206, 224, 231, 19,  31,  139, 177, 201, 100, 37,  8,   94,
        145, 135, 217, 32,  59,  26,  243, 213, 97,  78,  145, 136, 142, 249, 46,  247, 20,  240, 47,  211, 60,  35,
        170, 0,   119, 14,  36,  7,   165, 132, 35,  199, 33,  45,  27,  111, 135, 50,  210, 248, 118, 162, 199, 152,
        28,  202, 222, 8,   191, 40,  134, 213, 36,  131, 198, 76,  82,  212, 26,  33,  219, 181, 213, 205, 104, 118,
        74,  239, 226, 65,  161, 29,  158, 223, 175, 214, 160, 65,  229, 56,  207, 64,  194, 167, 85,  221, 82,  56,
        182, 226, 206, 71,  203, 116, 201, 234, 16,  42,  32,  47,  149, 161, 173, 60,  195, 59,  138, 241, 52,  152,
        48,  57,  137, 206, 201, 58,  242, 139, 149, 42,  185, 94,  27,  224, 249, 33,  24,  18,  148, 104, 89,  163,
        94,  214, 232, 133, 74,  124, 117, 39,  0,   73,  86,  254, 186, 224, 96,  236, 113, 39,  28,  245, 218, 147,
        215, 62,  191, 23,  20,  27,  32,  151, 25,  225, 3,   157, 221, 133, 124, 35,  41,  177, 93,  137, 198, 96,
        129, 235, 21,  10,  110, 16,  25,  65,  153, 157, 139, 82,  24,  43,  4,   180, 238, 174, 226, 183, 56,  224,
        239, 130, 62,  40,  12,  226, 219, 164, 71,  242, 179, 227, 53,  148, 38,  228, 151, 2,   249, 132, 56,  253,
        10,  107, 241, 56,  97,  88,  198, 203, 33,  132, 212, 44,  239, 7,   206, 156, 144, 93,  44,  71,  40,  171,
        60,  234, 89,  238, 114, 240, 145, 141, 51,  180, 85,  75,  125, 219, 2,   121, 53,  12,  223, 90,  174, 248,
        45,  39,  151, 5,   155, 29,  244, 124, 156, 60,  250, 52,  54,  186, 95,  245, 18,  51,  52,  183, 105, 226,
        245, 214, 94,  254, 98,  14,  46,  203, 225, 95,  126, 178, 49,  82,  159, 231, 170, 250, 63,  162, 156, 218,
        184, 211, 76,  181, 97,  180, 239, 45,  135, 147, 49,  147, 0,   32,  22,  77,  209, 215, 54,  83,  29,  127,
        80,  150, 50,  15,  69,  33,  118, 255, 168, 201, 2,   218, 13,  53,  164, 101, 34,  218, 110, 107, 147, 5,
        78,  135, 1,   11,  242, 43,  181, 108, 107, 46,  176, 74,  2,   251, 26,  97,  254, 79,  204, 97,  41,  90,
        126, 81,  202, 70,  30,  70,  50,  25,  56,  249, 245, 159, 6,   102, 21,  85,  8,   94,  115, 88,  32,  33,
        111, 138, 229, 238, 152, 198, 74,  111, 86,  151, 165, 232, 2,   13,  42,  228, 219, 158, 227, 203, 47,  8,
        83,  139, 184, 165, 123, 55,  29,  198, 119, 78,  182, 200, 77,  8,   5,   135, 164, 82,  235, 210, 47,  105,
        53,  186, 64,  197, 24,  14,  39,  161, 187, 136, 58,  118, 225, 162, 203, 5,   214, 155, 45,  3,   111, 126,
        99,  196, 82,  14,  156, 165, 134, 83,  179, 5,   226, 237, 151, 0,   219, 251, 160, 239, 224, 133, 230, 237,
        221, 233, 12,  3,   189, 28,  251, 245, 89,  116, 113, 176, 40,  210, 216, 173, 154, 216, 111, 254, 183, 238,
        29,  85,  142, 189, 89,  235, 184, 241, 2,   99,  138, 222, 47,  128, 97,  235, 195, 106, 118, 196, 149, 53,
        188, 70,  113, 85,  90,  53,  179, 32,  23,  28,  95,  164, 49,  61,  151, 70,  214, 245, 245, 117, 172, 75,
        153, 117, 226, 69,  205, 173, 139, 140, 163, 107, 214, 18,  111, 194, 115, 236, 32,  239, 168, 62,  12,  207,
        220, 162, 160, 13,  147, 252, 192, 145, 150, 207, 112, 196, 114, 88,  69,  252, 193, 37,  84,  103, 108, 32,
        205, 224, 216, 206, 251, 185, 17,  55,  185, 112, 24,  8,   209, 184, 156, 65,  48,  196, 236, 45,  97,  65,
        218, 239, 59,  191, 137, 3,   182, 135, 46,  142, 163, 39,  63,  219, 66,  166, 8,   41,  175, 79,  77,  134,
        159, 149, 118, 63,  191, 86,  103, 32,  2,   239, 107, 199, 122, 148, 93,  252, 176, 112, 130, 88,  102, 225,
        199, 89,  100, 221, 177, 118, 102, 77,  192, 224, 117, 13,  213, 164, 87,  91,  157, 211, 14,  248, 15,  0,
        165, 101, 185, 228, 203, 227, 44,  157, 68,  34};
    EXPECT_NO_THROW(r->set_u8_2(AttachRRArray(u8_2a, 714, false)));
    uint8_t u8_2b[] = {
        20,  34,  154, 240, 82,  27,  230, 242, 253, 161, 17,  124, 80,  120, 210, 237, 179, 95,  224, 104, 74,  77,
        148, 17,  98,  7,   13,  203, 155, 197, 223, 36,  207, 87,  56,  56,  76,  112, 100, 154, 40,  239, 13,  185,
        77,  91,  107, 73,  196, 234, 3,   235, 40,  222, 224, 46,  47,  150, 167, 104, 206, 245, 20,  181, 133, 190,
        255, 1,   183, 218, 5,   121, 233, 68,  72,  140, 250, 213, 199, 143, 41,  22,  238, 149, 235, 42,  170, 2,
        58,  242, 91,  116, 62,  167, 113, 28,  8,   0,   199, 142, 8,   102, 60,  87,  147, 104, 125, 163, 135, 1,
        186, 44,  117, 103, 186, 50,  68,  179, 203, 61,  231, 80,  45,  35,  231, 127, 93,  49,  154, 182, 1,   151,
        111, 70,  127, 13,  41,  113, 170, 41,  173, 14,  129, 108, 235, 166, 153, 50,  203, 42,  43,  93,  243, 114,
        190, 225, 12,  227, 24,  221, 177, 188, 218, 55,  6,   199, 162, 67,  152, 185, 216, 108, 251, 225, 146, 85,
        220, 192, 36,  39,  20,  189, 24,  117, 98,  107, 215, 238, 145, 113, 40,  184, 110, 186, 66,  207, 164, 43,
        70,  242, 211, 65,  232, 92,  164, 178, 3,   120, 1,   28,  247, 234, 210, 20,  61,  83,  147, 174, 177, 131,
        229, 117, 211, 161, 73,  161, 224, 80,  219, 151, 131, 42,  37,  46,  68,  213, 62,  101, 8,   143, 146, 103,
        52,  69,  7,   241, 55,  191, 104, 208, 100, 192, 48,  199, 30,  38,  148, 25,  252, 47,  18,  152, 142, 181,
        231, 205, 166, 171, 14,  236, 15,  232, 235, 36,  66,  88,  141, 87,  66,  9,   94,  214, 100, 227, 207, 1,
        6,   102, 170, 53,  53,  152, 136, 115, 251, 227, 218, 164, 20,  109, 174, 36,  135, 122, 237, 146, 226, 42,
        202, 183, 112, 68,  121, 92,  23,  75,  34,  228, 131, 141, 52,  12,  132, 12,  43,  220, 33,  110, 30,  120,
        244, 192, 128, 190, 89,  109, 165, 9,   25,  27,  129, 135, 80,  17,  217, 152, 237, 241, 56,  233, 78,  224,
        115, 143, 214, 201, 78,  139, 50,  185, 115, 234, 31,  11,  190, 244, 28,  93,  13,  153, 78,  154, 62,  86,
        40,  133, 29,  12,  133, 69,  50,  197, 127, 242, 14,  173, 70,  116, 243, 200, 197, 245, 249, 231, 139, 46,
        99,  37,  55,  220, 57,  103, 163, 71,  252, 54,  52,  254, 97,  158, 155, 249, 243, 55,  112, 226, 88,  25,
        29,  41,  109, 6,   219, 193, 89,  193, 164, 166, 103, 119, 69,  214, 105, 14,  20,  208, 56,  231, 59,  68,
        49,  107, 119, 99,  109, 210, 234, 228, 111, 219, 32,  211, 172, 101, 172, 99,  227, 112, 137, 204, 19,  3,
        111, 219, 245, 89,  106, 32,  108, 234, 81,  72,  27,  99,  151, 212, 108, 37,  248, 183, 241, 194, 37,  73,
        230, 130, 11,  6,   122, 220, 192, 114, 116, 208, 187, 159, 226, 98,  191, 253, 226, 39,  212, 138, 106, 196,
        153, 61,  218, 218, 20,  238, 82,  237, 196, 114, 135, 239, 221, 20,  52,  73,  208, 234, 99,  185, 218, 218,
        47,  95,  218, 110, 165, 216, 121, 249, 203, 206, 213, 201, 138, 253, 43,  238, 131, 62,  229, 123, 69,  175,
        61,  176, 180, 72,  120, 158, 91,  145, 16,  162, 70,  54,  170, 170, 60,  9,   226, 40,  66,  159, 139, 83,
        20,  171, 32,  189, 140, 122, 1,   64,  144, 250, 94,  74,  91,  160, 146, 146, 17,  78,  43,  115, 166, 63,
        81,  88,  83,  178, 177, 110, 93,  188, 29,  41,  28,  73,  40,  245, 49,  63,  134, 103, 135, 17,  172, 150,
        249, 23,  230, 166, 31,  55,  203, 149, 19,  4,   101, 237};
    EXPECT_RRARRAY_EQ(AttachRRArray(u8_2b, 628, false), r->get_u8_2());

    uint32_t u8_3_1a1[] = {30, 10};
    uint8_t u8_3_1a2[] = {
        66,  135, 166, 109, 89,  156, 182, 63,  217, 36,  212, 158, 7,   212, 235, 154, 155, 52,  234, 220, 30,  251,
        223, 77,  163, 204, 220, 63,  152, 39,  193, 217, 212, 4,   248, 69,  117, 164, 83,  149, 60,  44,  96,  78,
        166, 212, 56,  87,  183, 20,  0,   32,  244, 16,  155, 4,   82,  217, 235, 203, 171, 188, 222, 15,  0,   109,
        97,  135, 62,  185, 103, 39,  200, 198, 50,  190, 246, 161, 102, 32,  246, 11,  26,  132, 145, 141, 15,  112,
        193, 105, 130, 61,  177, 104, 39,  164, 188, 131, 6,   9,   222, 109, 161, 211, 254, 73,  117, 59,  96,  146,
        92,  148, 175, 82,  108, 215, 210, 4,   7,   176, 191, 129, 174, 224, 139, 166, 71,  30,  57,  246, 94,  139,
        121, 190, 210, 181, 44,  71,  7,   118, 76,  223, 173, 181, 88,  138, 18,  146, 233, 135, 205, 101, 92,  222,
        136, 177, 15,  167, 154, 198, 194, 185, 166, 21,  49,  193, 229, 153, 231, 101, 47,  40,  181, 138, 207, 168,
        73,  19,  108, 15,  22,  193, 101, 151, 216, 153, 20,  140, 209, 15,  117, 246, 86,  210, 193, 254, 56,  41,
        223, 107, 179, 130, 220, 46,  248, 200, 241, 173, 67,  147, 93,  87,  108, 13,  180, 112, 58,  210, 243, 94,
        113, 140, 172, 53,  206, 186, 106, 167, 48,  43,  213, 157, 135, 243, 72,  173, 185, 62,  188, 162, 61,  19,
        156, 215, 24,  216, 222, 56,  211, 151, 178, 251, 238, 47,  51,  141, 109, 214, 179, 41,  5,   190, 79,  27,
        13,  208, 37,  97,  178, 83,  150, 77,  187, 179, 12,  73,  156, 167, 167, 106, 198, 157, 133, 80,  183, 15,
        1,   204, 84,  250, 122, 232, 178, 103, 225, 110, 97,  23,  171, 88};
    EXPECT_NO_THROW(r->set_u8_3(
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(u8_3_1a1, 2, false), AttachRRArray(u8_3_1a2, 300, false))));
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > u8_3_2 = r->get_u8_3();
    uint32_t u8_3_1b1[] = {10, 20};
    uint8_t u8_3_1b2[] = {23,  5,   170, 52,  174, 242, 108, 186, 30,  27,  38,  181, 184, 103, 240, 129, 69,  179, 148,
                          194, 57,  7,   19,  111, 244, 86,  238, 36,  31,  44,  193, 106, 229, 159, 23,  70,  184, 121,
                          243, 215, 187, 115, 89,  141, 233, 105, 150, 224, 245, 251, 44,  148, 149, 123, 141, 9,   77,
                          17,  146, 157, 112, 122, 83,  50,  156, 178, 186, 244, 234, 165, 6,   223, 148, 48,  189, 46,
                          209, 30,  203, 186, 4,   159, 162, 97,  97,  232, 113, 178, 244, 172, 54,  52,  252, 32,  35,
                          131, 178, 21,  131, 165, 203, 113, 141, 3,   195, 54,  143, 163, 15,  99,  29,  235, 125, 45,
                          50,  157, 255, 7,   81,  221, 70,  225, 119, 220, 98,  55,  213, 23,  219, 152, 148, 113, 89,
                          236, 109, 187, 7,   80,  140, 226, 71,  34,  17,  176, 15,  30,  239, 251, 10,  64,  170, 150,
                          245, 180, 83,  242, 138, 154, 226, 193, 119, 43,  85,  164, 187, 73,  19,  81,  119, 168, 160,
                          222, 100, 230, 27,  237, 43,  71,  144, 132, 212, 131, 241, 195, 181, 175, 41,  115, 149, 128,
                          238, 212, 134, 110, 224, 149, 217, 213, 122, 200};
    EXPECT_RRARRAY_EQ(u8_3_2->Dims, AttachRRArray(u8_3_1b1, 2, false));
    EXPECT_RRARRAY_EQ(u8_3_2->Array, AttachRRArray(u8_3_1b2, 200, false));

    // int16
    EXPECT_NO_THROW(r->set_i16_1(2387));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_i16_1(), -13428));
    int16_t i16_2a[] = {
        -29064, 7306,   1457,   -19474, -671,   22876,  -14357, -18020, -23418, -10298, 1040,   -2415,  -22890, 4293,
        25366,  12606,  -31678, -15908, -11164, 20643,  -239,   -15149, 25272,  17505,  24037,  8264,   -3888,  -12405,
        -28698, 25222,  -2506,  -26405, 9561,   27093,  8022,   23338,  -31489, 24117,  18018,  25324,  -22192, -23413,
        -12544, -29675, -10752, -7108,  3021,   29238,  -10332, -1818,  23363,  31568,  -15057, 9565,   30520,  1064,
        26637,  -29070, 11149,  8534,   -13775, -18359, 9626,   10662,  -23713, 28470,  8840,   -25279, 18175,  13675,
        14955,  30323,  924,    -13113, -21483, -6641,  12790,  26367,  27907,  -1062,  -24249, -13215, -18475, -11121,
        2339,   -2361,  -7790,  -26038, -6984,  -10142, 8485,   17258,  6150,   -25530, 9655,   -11378, -805,   11574,
        16094,  21091,  -11882, 21514,  27655,  -27624, -23592, 17985,  3154,   -1292,  11059,  27599,  -2741,  -27514,
        -27353, -1824,  -26419, -19633, 23008,  22184,  25855,  -4965,  -18710, -6802,  25237,  -24262, 3253,   -28401,
        -19864, -11711, -27668, 28671,  -1376,  -8600,  -12691, -18972, -5265,  3901,   -6694,  19018,  29612,  8047,
        -26257, 28662,  -6164,  9407,   -12556, 1421,   14531,  28000,  8499,   5512,   28989,  -17181, -4051,  28130,
        19063,  31736,  -28399, -4663,  25520,  -18490, -32156, -15267, 29245,  -13510, 13446,  -31039, 18030,  25419,
        24594,  28348,  17845,  -26123, 20713,  29810,  -25881, -10534, 9038,   -15614, 20117,  11436,  7078,   9985,
        -2758,  -13790, 12865,  -6824,  10924,  -4750,  10127,  -30953, -15114, -10407, 13061,  -13241, 22268,  15514,
        -23952, -22361, 25465,  -23395, -5885,  23643,  6634,   1768,   -4390,  -29064, -18261, -18954, 22866,  -23739,
        -15996, -31521, -12816, -11246, -16029, 4113,   -18809, -4282,  -3892,  -21196, 23692,  6488,   -8949,  28859,
        23717,  -20358, -4216,  6700,   -14565, 14268,  -17978, -3865,  21937,  17864,  -26293, -9181,  28460,  -27725,
        -32278, -13856, -21763, 10310,  -4066,  32078,  -8132,  -14677, -11698, -23123, -30968, -21889, -2192,  29299,
        623,    -26725, -29380, -18038, -25037, 26361,  22773,  -31157, 22096,  10336,  26530,  -74,    3820,   52,
        -28257, -29110, -29891, -23752, -23846, -15516, -21528, 14792,  -4286,  26942,  17922,  21495,  16249,  -30305,
        3056,   -22525, -4198,  28613,  2695,   30388,  -18066, -5162,  -23655, -25604, -28244, -1196,  -6888,  17903,
        11721,  13555,  32445,  31800,  11125,  -31537, 1400,   25992,  2289,   -19330, 29486,  -27986, -6690,  9402,
        15366,  18268,  29476,  27543,  -26894, 28279,  -18810, -14493, 6622,   9548,   28691,  30421,  -17983, -25525,
        -6167,  5825,   -25283, 19498,  -17719, -3858,  8518,   16017,  1325,   -16864, 17874,  -796,   3678,   -32078,
        -19712, -32173, -25895, 27397,  23474,  10508,  -6009,  25388,  17327,  26954,  -23909, 27502,  -15956, -1770,
        1343,   -30108, -12923, -3584,  -30762, 3386,   18090,  -14048, 31833,  -5312,  -32483, -1358,  -28372, -24388,
        -26718, -17132, 22775,  16924,  -8991,  -12343, 16874,  19515,  21977,  -26287, -28976, -18071, -24572, -8740,
        29859,  -21779, -20087, -928,   31016,  -11442, 16890,  -12445, 26140,  23581,  -18737, 16033,  -16426, -27860,
        -4853,  6669,   -2678,  -14760, 15011,  25458,  -24354, -4704,  1983,   20655,  -3885,  -6015,  -20382, -6168,
        -8801,  21318,  21969,  15333,  26667,  -15860, -20356, -4265,  -19871, -30123, 8082,   -5186,  -5294,  -7119,
        -23580, 600,    7195,   24630,  -9810,  -23846, 23416,  -26102, 11875,  25362,  -17002, 32482,  3733,   8434,
        18377,  -11770, 21843,  -19779, 27194,  -16918, -22013, 8387,   -1686,  -27228, -8013,  -12979, 30682,  13008,
        -32188, 24547,  27126,  12811,  -14996, 16305,  16467,  21204,  -16620, 20671,  31564,  -23123, -31995, 6335,
        -26234, -8852,  -19185, -19636, -15411, 22541,  10295,  -14022, -19669, 25371,  4407,   -21395, -20754, -31164,
        -30944, -29004, -28877, 11049,  -11492, 30171,  -3452,  20020,  -30618, 11178,  7734,   15658,  26485,  -8697,
        24391,  14520,  -9994,  -11594, 21221,  21327,  22058,  -6275,  -2272,  20061,  11315,  26569,  21368,  30729,
        -15573, -25453, -6160,  -20236, -29377, -22591, -11045, 19992,  -18369, -30261, -32159, 27646,  18350,  -6134,
        6723,   -13437, -23761, -22496, -12447, -1184,  -17634, -20936, 30815,  32042,  10621,  17252,  9705,   4169,
        -8075,  -20113, -21095, -20310, -3917,  23438,  -1628,  7291,   -18739, -12603, 22036,  -14198, 26960,  -24387,
        -20204, 1370,   -23683, -27522, 31684,  -24806, -20567, 606,    -14584, -5656,  -6025,  20297,  -18716, -7075,
        21089,  -26036, -2747,  -18800, 22214,  -31288, -31916, -32543, 14577,  -6407,  17079,  4683,   -29301, -13707,
        4296,   -2247,  -25994, -322,   -26904, -4444,  24454,  -9676,  29589,  30545,  17995,  20596,  24835,  24545,
        -15782, 13901,  -26644, 4655,   -10543, -24521, 30118,  -29985, 3163,   -27379, 24263,  19271,  12184,  7695,
        -6249,  -26163, -16952, -18930, -22627, 5625,   -16862, -29626, 8000,   -26542, -21846, 8377,   -6837,  -30324,
        10752,  19676,  -31224, -11472, 27419,  4926,   -67,    7107,   3149,   -18440, 18652,  -32124, 26094,  -7015,
        -10179, 3878,   28709,  4453,   20330,  -27548, -18729, -7550,  -29815, -3110,  -14705, -16383, 16020,  15466,
        5411,   23434,  -14919, -1289,  24403,  -2409,  -28824, -5982,  21794,  -26131, 11683,  28742,  -21742, 7952,
        -9041,  28373,  12434,  -17665, -19141, -31576, 650,    -11103, -26587, -17144, 20830,  1468,   23981,  -6189,
        -1574,  11151,  9314,   12189,  -19801, 23310,  3132,   1145,   -5231,  1387,   3230,   -15314, -17253, -29867,
        22979,  -28009, 7686,   -31739, -16295, 23702,  9141,   18300,  31485,  -11124, -30999, -26289, -32371, 7900,
        -5057,  -8202,  -15209, -26424, -2712,  -25152, -7174,  -25019, -14712, -10703, -2809,  -9,     -17905, 20882,
        31301,  8989,   20139,  -235,   707,    -23246, 4519,   5621,   9609,   -10846, -1873,  -17425, 30184,  23010,
        18718,  24429,  -2168,  23884,  -19503, 9419,   -24927, -16803, 11872,  16572,  -30227, 4356,   18692,  3493,
        -29119, 16296,  1632,   8736,   7806,   -13904, -26360, -27538, 6861,   -8093,  -6184,  -445,   -2181,  -9581,
        -2722,  22857,  4100,   -2585,  -25935, -26353, -21284, 7497,   -5385,  10974,  -7747,  -19865, -1205,  -12806,
        -7505,  -29792, 16793,  -2743,  30123,  9379,   17381,  4947,   -15940, -3652,  -1797,  21012,  -10333, -27953,
        -1716,  -28455, 29598,  17497,  -5363,  -3990,  -29921, -27210, 8825,   8046,   11062,  -13647, 29708,  1335,
        -22559, -28213, -9634,  -17768, 32543,  -15641, -18576, -23375, -25305, 11930,  11338,  28057,  12085,  -17504,
        29366,  3513,   26451,  29229,  -24338, 1541,   18497,  -8424,  12969,  -20692, -24323, 1876,   8233,   10893,
        -10761, -3855,  -21938, -6268,  32120,  -25120, 20729,  -371,   25746,  28224,  -25625, -22924, -30667, 13100,
        -3160,  28610,  2206,   977,    -17607, -2173,  24212,  14451,  22276,  26268,  -10890, -23818, 30052,  -18695,
        14828,  -16839, -18543, 17056,  -3715,  -7372,  -16029, 31885,  -20617, 10847,  -12068, 29898,  12865,  30922,
        17546,  -8489,  19324,  584,    9798,   2421,   -17432, -10905, -14728, -7920,  6909,   -11895, 1031,   18387,
        20783,  -28969, -535,   31095,  -30709, 28734,  15322,  28585,  2100,   -6234,  -28704, -2813,  22201,  16682,
        -1576,  9351,   30508,  -9447,  -21309, 3023,   -19963, 13739,  8398,   -11148, -9348,  32285,  -22925, 697,
        -9683,  -1106,  11252,  -16321, 31326,  -22577, -107,   3355,   22765,  -10391, -26902, 10375,  -2846,  -21378,
        2649,   1284,   23016,  6884,   -5356,  -17352, -9866,  -4313,  15950,  12058,  -32753, 6124,   -9833,  8828,
        -11711, -28691, -31249, -31354, 13039,  29161,  -17382, -5879,  -21118, 11736,  -29024, -15440, 9364,   28121,
        16093,  20123,  -26504, 25957,  11858,  9932,   -11333, -15770, 3678,   -18107, -25852, -21244, 2225,   -13899,
        2050,   -21656, -7352,  -3896,  4161,   -27416, 12792,  -1807,  18088,  -9590,  1851,   -11661, -28665, 10986,
        18137,  22612,  -1617,  -11139, 19293,  4080,   8597,   -16998, 17228,  6587,   12316,  12640,  1001,   25972,
        29637,  27715,  5577,   -12737};
    EXPECT_NO_THROW(r->set_i16_2(AttachRRArray(i16_2a, 998, false)));
    int16_t i16_2b[] = {
        -31396, -31525, 21618,  420,    -4709,  -28067, 13158,  30433,  -5226,  177,    32486,  -24906, 14134,  -12316,
        815,    14221,  25078,  4427,   -24570, -2404,  32275,  16625,  -18211, 8224,   11466,  -8053,  25673,  -5521,
        -3629,  -28951, 16888,  3476,   29692,  -16313, -6124,  7022,   20178,  363,    -26079, 6451,   26271,  -9454,
        7484,   9626,   18076,  -32556, 8132,   22992,  -22922, 21831,  9586,   30404,  -24016, -22082, 17247,  -120,
        26786,  -30338, 6445,   7710,   12192,  1787,   10373,  8221,   9130,   -13265, -29233, -30762, 1430,   29737,
        1503,   32216,  -27766, 25651,  24365,  -20157, 18077,  -9909,  -2427,  -14841, -32092, 2606,   -29807, 31676,
        -2674,  21400,  -31068, -7881,  15682,  -5497,  -4695,  -7670,  -26719, 7180,   31393,  20250,  -18099, 12591,
        18352,  16854,  24663,  -12445, 3967,   13535,  -9324,  -28110, 13977,  -23172, 14216,  30378,  6653,   19203,
        7298,   -23065, 18301,  27111,  -23775, -27934, -4797,  22319,  -5834,  -10073, 21636,  26423,  20007,  -23826,
        9433,   24251,  29231,  26264,  2698,   -10085, -21536, -27028, -24687, -3768,  1511,   25182,  29258,  -17177,
        8345,   9571,   7512,   -28872, 10123,  -10644, -7612,  -13232, 24346,  -25900, 28049,  -5366,  -8968,  5589,
        -21840, 21891,  25327,  9095,   4382,   -30532, -21172, -27251, 12320,  30065,  -29933, 19371,  -5654,  7815,
        -26289, 12614,  13834,  29357,  25201,  -32309, 20042,  16706,  2312,   -20975, -5346,  1820,   9166,   20644,
        -3811,  -12569, -3711,  11580,  -24719, 29072,  -26433, -12475, -15326, 1071,   10750,  -17120, 21953,  11265,
        3513,   20747,  32085,  9898,   -24426, -17231, 21523,  -26126, 8783,   31762,  6629,   -32554, 28071,  23409,
        -6423,  -25261, -13387, -2606,  -23878, 5003,   -8970,  16999,  -11501, 15402,  -31573, -12730, 17823,  3018,
        13959,  6305,   -24676, -28537, -21613, 15353,  -31686, 7264,   14978,  -2702,  25179,  16061,  -5220,  -20419,
        17023,  -5104,  -17836, -24537, 30832,  -8236,  20473,  31052,  9467,   25660,  -4882,  28392,  -16236, 15059,
        18409,  2709,   9637,   -28754, -28261, 14474,  281,    24844,  25464,  26378,  8331,   -8080,  -10826, -3874,
        21290,  1599,   -375,   8436,   -25280, 25907,  19361,  6448,   -26639, -15164, -12896, 1476,   -15877, 23427,
        -24851, -23147, -11525, 16456,  -23417, 31519,  -10431, -14222, -28958, 6194,   -7802,  17086,  -5885,  23977,
        29347,  3648,   29674,  -27985, 1834,   30677,  -30455, 32438,  -23495, -10403, 10370,  32713,  27187,  -4733,
        -16686, -21336, 7793,   15123,  17046,  28022,  -23346, 21816,  16826,  19747,  21625,  17895,  -23683, -142,
        -27996, 6601,   -13889, 24112,  -19505, 24425,  11673,  -3507,  -9946,  20693,  -28974, -30639, 25202,  -24295,
        27916,  5920,   17325,  29121,  12475,  -1179,  5379,   -21558, -8684,  7551,   -8536,  8673,   -13435, -3870,
        -6389,  -26193, 13662,  -17405, 3305,   -15401, -10014, 6645,   -9322,  -15604, 7511,   -8894,  -2421,  -21984,
        -12209, 16631,  19022,  11644,  -3624,  25297,  6613,   4801,   -17413, -12780, -28095, 17986,  11066,  22207,
        17717,  3613,   14987,  -19860, 12693,  -13482, 10471,  -24561, 32333,  -25968, 7244,   7005,   17820,  -18897,
        13208,  16753,  32551,  21296,  -15046, -3886,  -13628, -2550,  16059,  1090,   -27901, 21254,  21726,  -17180,
        5902,   30053,  31909,  25120,  3958,   18119,  -25501, -4974,  -11464, 24068,  19720,  -8793,  -9011,  -11975,
        7025,   -15041, 21009,  -15123, 3647,   -28657, -7700,  -10174, -16814, 4848,   13044,  -20100, -17977, -29197,
        31169,  15459,  -27346, -23297, 1639,   -27165, 25474,  -4981,  -16728, 24962,  6895,   16619,  12965,  10990,
        -13275, 1119,   -10243, 10364,  3763,   3565,   31542,  -22261, 15267,  -31448, 13298,  -8408,  511,    19296,
        24390,  -25118, -29033, 11413,  25520,  -23675, -12986, -3952,  7133,   9587,   30652,  -21444, 23859,  22577};
    EXPECT_RRARRAY_EQ(AttachRRArray(i16_2b, 476, false), r->get_i16_2());

    // uint16
    EXPECT_NO_THROW(r->set_u16_1(54732));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_u16_1(), 60981));
    uint16_t u16_2a[] = {
        27153, 43996, 41432, 58304, 12942, 58876, 28186, 11185, 10827, 17769, 13091, 23017, 17671, 49113, 6987,  35547,
        2024,  33499, 26956, 11772, 20498, 42863, 65021, 31883, 61940, 6622,  59235, 6137,  51350, 48773, 57425, 56027,
        38431, 12927, 54445, 12445, 27087, 33727, 51305, 48371, 7488,  32356, 59057, 10185, 57955, 46571, 326,   43692,
        43661, 25990, 42979, 8957,  59425, 9205,  42414, 10752, 5573,  37965, 14726, 60329, 24708, 38900, 13804, 12531,
        19400, 40437, 3102,  15384, 9922,  48890, 655,   58588, 55933, 56542, 20001, 11584, 62303, 19888, 38565, 19636,
        21974, 26170, 61468, 27655, 30144, 38002, 59044, 33839, 58996, 7516,  41660, 26146, 20606, 9052,  41933, 43479,
        45221, 37564, 60731, 9073,  5647,  25184, 21426, 47334, 48473, 57336, 38775, 56475, 55863, 33194, 59184, 17109,
        10792, 35915, 37682, 18123, 56383, 55538, 26718, 29128, 5521,  51803, 22632, 19827, 32242, 38280, 51359, 10800,
        22661, 63621, 58920, 22073, 59845, 56670, 24860, 21801, 22225, 45849, 35453, 38351, 58831, 63677, 49340, 58625,
        59284, 8244,  22567, 42599, 39629, 44023, 55480, 23933, 54557, 36080, 18074, 53598, 26233, 46291, 10356, 982,
        20899, 9791,  43246, 40308, 38630, 40376, 23805, 35194, 45957, 56662, 38493, 50650, 41811, 40225, 20212, 10975,
        38947, 14443, 62213, 16366, 55641, 20063, 28304, 34336, 48695, 11196, 20382, 32670, 61020, 27154, 60750, 42124,
        64065, 45687, 32335, 60310, 14344, 39059, 31190, 12119, 57101, 13774, 58824, 54012, 32689, 12347, 13368, 42262,
        15453, 61631, 51804, 27658, 53000, 30414, 42427, 61957, 16811, 19230, 23527, 24728, 60773, 28925};
    EXPECT_NO_THROW(r->set_u16_2(AttachRRArray(u16_2a, 222, false)));
    uint16_t u16_2b[] = {
        28720, 34616, 62158, 23483, 4737,  55943, 56769, 39984, 64598, 51111, 51377, 21150, 23557, 7441,  55455, 37627,
        34814, 32887, 12525, 7947,  30317, 19555, 62568, 26666, 35231, 38385, 56455, 37676, 47722, 60644, 1037,  61159,
        64542, 21655, 57027, 46262, 64919, 49927, 25520, 56784, 4424,  62463, 26885, 43771, 5149,  7537,  28615, 2661,
        41921, 63221, 30209, 37930, 9683,  52406, 24968, 50022, 51469, 57731, 65408, 57019, 62539, 10550, 35726, 34413,
        46756, 63743, 50854, 1075,  36709, 52737, 38989, 14194, 10541, 39864, 7632,  6335,  37317, 18084, 18417, 13903,
        41588, 4410,  55813, 34564, 62937, 56211, 51771, 32961, 36295, 58221, 4107,  18571, 55106, 52625, 36243, 52487,
        10236, 36619, 24439, 41204, 61791, 12156, 5380,  26272, 45613, 37851, 60070, 38759, 33502, 2147,  28146, 45977,
        51698, 33640, 38956, 48664, 51750, 42329, 6020,  42645, 44393, 47459, 64398, 2683,  18251, 5304,  38780, 13706,
        58825, 12565, 37762, 21280, 39402, 56275, 25627, 41371, 39366, 61829, 8892,  26779, 311,   47322, 26823, 8265,
        12495, 38802, 20059, 32724, 7618,  37557, 57579, 33492, 20655, 19185, 57872, 51794, 16721, 52071, 52584, 57226,
        28584, 9690,  10117, 41708, 38496, 56164, 53099, 45246, 34962, 41133, 9780,  39381, 53780, 14719, 64870, 38034,
        15484, 24376, 39802, 58424, 52906, 45995, 50396, 21981, 32813, 15889, 33981, 58999, 48157, 23717, 24644, 18059,
        47204, 45872, 26705, 46193, 56697, 41192, 56316, 43920};
    EXPECT_RRARRAY_EQ(AttachRRArray(u16_2b, 200, false), r->get_u16_2());

    // int32
    EXPECT_NO_THROW(r->set_i32_1(-9837284));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_i32_1(), 898734));
    int32_t i32_1a[] = {
        -966485083,  547919123,   -1194190604, 1550099195,  -86896479,   -1346998266, -111775936,  1595883280,
        95277373,    -483593724,  -1194231658, -1664247993, -1125879490, -774112094,  -908971354,  1257430739,
        278831106,   2146175077,  1216734947,  108534888,   712376825,   472415212,   -413092215,  -186896831,
        -983274891,  -814159203,  491332674,   -1080086896, 305863740,   -588641755,  -1173634854, 1500595228,
        -1011735210, 1396816521,  -1843412764, -1174697157, -2042333138, 1720132956,  1179474025,  -734588992,
        1928960553,  653905969,   -1152761709, 206317133,   1066603916,  1788908206,  1901091544,  1610435338,
        -1051581785, -1953636422, 1076388567,  1462395490,  -237116033,  454691362,   1619801391,  1845599647,
        1868321380,  1723200218,  766619638,   105371815,   -877177590,  -1885723170, 434710859,   -1146593520,
        209995917,   -1047842747, 465673729,   -2084508649, 1968279245,  587205365,   1583233886,  -1752333729,
        -114021301,  59161723,    1580036234,  345745650,   -468378351,  245003371,   1673787261,  1587452615,
        -1303597866, 822157520,   64527339,    -4281296,    -64380840,   37142322,    500059241,   -1469346913,
        11916922,    -338760031,  -2025817128, 83726551,    -754215578,  368103720,   -821582629,  717962460,
        2144471201,  223671109,   -199755353,  -841621639,  1540857720,  1804628518,  2118963299,  -1595232224,
        400238135,   933224750,   -215585205,  -985264044,  -988901458,  986847698,   -1856650438, -651146661,
        -978168494,  -532172509,  1691932093,  1876106029,  525396768,   1743090554,  -162073951,  806798458,
        -1403694340, 559542160,   207806919,   590536881,   -1650417281, 1858408059,  1983218923,  -1543131382,
        1706115652,  2119926306,  1424134413,  1205448675,  1811525641,  861875958,   2007619106,  -845489490,
        -55633190,   1816674890,  -614507920,  286578932,   -1342898663, -1261324825, -1506404786, -1806499804,
        1974771054,  -98303714,   -290587554,  1090231453,  -985937256,  -839357172,  -1416681172, -1007624128,
        -1578990962, -1728169897, -844916635,  506302833,   667662716,   -663874058,  -1362455403, -2060230793,
        -1319792032, -2017894569, -1689519196, 479605380,   -117340189,  -1052087080, 1498560347,  -870303564,
        1098382715,  -2086046098, -1642542296, -628648039,  -719920250,  -2060321401, 525438216,   281529006,
        -459505556,  -1796557506, 1024549346,  1853853925,  -312303325,  -1579857332, -1269984071, 473304768,
        721731410,   -1737559733, -438494623,  1802127802,  -1731233704, -1390726345, 485787940,   943002107,
        -187237495,  1869312126,  442020547,   -87826467,   -696183927,  616713843,   945472556,   -972856985,
        151686386,   1488133092,  175341883,   -1180397098, 948926458,   -503479659,  -1267580010, -388943415,
        -1363469783, -1527776457, 268299441,   191219066,   -1024035842, -1475980660, 1828759673,  -1442955646,
        1790351422,  574018056,   1803848768,  -2095818881, 1210053959,  1551296999,  -942626269,  -1321443296,
        -1859662526, -2071020753, -1184904851, 988848078,   -412054768,  1493935320,  -196557049,  -704875093,
        134497249,   -1224190928, -2068208534, -965095455,  -564081208,  -1156543555, 461090533,   701882132,
        910649700,   -1878641070, 1446533896,  1970740772,  -204663013,  -1698033554, 972688594,   1110078968,
        810548960,   -1509538061, 1958800693,  -543420990,  217640235,   1880493927,  -1671735529, 1137613142,
        2072545208,  -414851757,  -1785997391, -364718164,  450315208,   -993471993,  768175939,   -1566579292,
        85961510,    -1827000830, -1893503205, 869202084,   713571555,   680257288,   1524440291,  1741022434,
        561415328,   1990319608,  1142451744,  39401847,    1221297801,  -2124038766, 1215377498,  -2068455826,
        560063055,   383922313,   7329552,     -1417241590, 1973186515,  358937975,   1808732034,  894888594,
        -1620703934, -1409454021, -224706429,  631015427,   -701827114,  -1980442971, -1243431585, 1865483925,
        -1340041763, 259984294,   -1443453841, -885229413,  973067512,   780961235,   -282514052,  -1110338800,
        -722213025,  1714985605,  -1287879595, 1509400751,  324286798,   1011968175,  1774625427,  -335835050,
        1241953488,  -485251005,  -2023480468, -1498664236, -1676758135, -2078759270, 368391173,   1770332091,
        602035732,   -1157125163, -726848951,  -296396612,  -418101410,  1516209091,  -433026570,  2065899179,
        286245383,   -1428168800, 310716072,   -563791242,  -1325785953, 1826452534,  -23905747,   1034013849,
        -1085065618, 1611085765,  -60799609,   1082236453,  561831452,   -1827984069, -277941810,  -2097393299,
        1609593516,  -1947366285, 2039786925,  -2039232768, 986451997,   2119304777,  49748214,    -1530450382,
        -588012225,  -142349556,  1234615466,  -1482467714, 728929313,   438851997,   -424861037,  -1835013005,
        -674124377,  -1634348548, 1081331853,  2111035427,  143997944,   -1158230701, 4815417,     2122369877,
        -77009634,   282329472,   2124624001,  1395262123,  -602351149,  1496495731,  -522090375,  -1089014497,
        1060099030,  -514142834,  624755360,   101709947,   -259648574,  -1721466978, -1470128315, 1344990842,
        -2138737258, 101466176,   1692425055,  -1157926775, 592741389,   1813083585,  -769169250,  1770253928,
        1208684737,  -702112980,  1001273019,  1705993099,  1407346099,  -2142523547, -1355363485, -267899641,
        449328343,   -987691219,  438101969,   572223309,   379113218,   1466899667,  -623010689,  2125548615,
        -145443483,  631502783,   1728343290,  1277749965,  1997442958,  -1429886186, -537022197,  763891225,
        -1238739363, -821719020,  940172257,   114964281,   2090254185,  -966856290,  1594918376,  -1912990965,
        1325705675,  1909184548,  837435170,   -590257590,  1748272543,  65934393,    2073600222,  170572472,
        -1901011521, 2133543824,  -1551997487, 1825478098,  -941111977,  2081346119,  1276024247,  -1737235139,
        1172151357,  1861822828,  2017860579,  2079359170,  -712881259,  353483674,   1081877284,  -310138121,
        -1387900910, 1509477224,  321767828,   -334162604,  -1426416668, 122601289,   900426562,   -1974038173,
        -187934215,  1716122553,  536633084,   653559614,   -106459236,  612788932,   -426096009,  -407044580,
        -231495552,  -20598604,   -1049988598, 1707164387,  -907341708,  1018148334,  420273830,   -717817139,
        746522674,   -1091234728, -769304365,  -1783917863, -1773360712, 1421244394,  -1489877988, -1400774353,
        704671809,   -523850319,  107160908,   2024605373,  -799692707,  -2092464355, -948361722,  -1132761744,
        429369122,   -76789764,   -1551036156, -1351725409, -11045966,   -1316255914, 1121595316,  1364255025,
        1812124631,  -1134809617, -1230048918, -1823006270, 103013418,   -1985924618, 1276352832,  1604221273,
        -237209206,  -1822616069, -1899068745, 1297703890,  -240045011,  810578223,   -1422419765, -1418704599,
        1034032605,  2085440174,  607645733,   716362365,   1235513555,  -1211579413, -261155896,  2022908495,
        -146539076,  1167671484,  -211945140,  -268072629,  40741212,    -317939085,  728869511,   1342184697,
        -522128634,  -716993901,  -885638830,  -1889540956, -518758183,  194076888,   -263047735,  -53295197,
        -2039369321, -1402107402, -1232069700, -860885703,  667080371,   2003791013,  -1792537425, 593890515,
        -302918528,  -371191726,  915728277,   1775934623,  -1884658077, 1983888460,  298800478,   1016157169,
        -1717781878, -1076292572, 1732073196,  542964773,   -773239025,  1070547456,  1719362726,  -1490080193,
        -1399780184, -58541011,   -1591258,    -1250990694, -443129975,  1822357515,  -1774941626, -1423917059,
        -1324183435, 1247654078,  -785941226,  208759350,   1371670412,  1903510098,  2128083745,  435649658,
        1127890999,  -1861063799, -188564302,  1199643492,  1891452416,  -217657738,  -67141750,   -1266789415,
        2131626424,  2098938511,  1874390421,  -1698831352, 1922731129,  1143118810,  -2026197630, 2086052126,
        842500141,   287962959,   850955114,   2012362088,  -817258418,  -1072214227, 978057684,   992062798,
        -2041866817, -1611489850, 1663409654,  112766564,   -1689406122, 1616786320,  556057860,   -1680102493,
        867719167,   453575899,   -191805706,  1712061526,  -744377824,  -615870979,  -1980362202, 1649307499,
        -613527529,  -514007552,  -354868527,  740361284,   1191787483,  1421727561,  1066283904,  -452434665,
        2020141000,  -1987374530, 412400833,   -621803967,  20900810,    559102704,   -443346658,  -768206607,
        1402289809,  -1479041896, 1359182666,  84692384,    1919671125,  1665432592,  -1427511811, 1351138729,
        714150331,   1584608034,  1063897075,  -470363603,  1537682572,  760337828,   270984358,   -1339485809,
        467876006,   1515737109,  -2141726672, 1046916347,  1259950801,  -835983188,  -2073384503, -697440699,
        1343223043,  -1288734811, 27645887,    -1066885181, 2063044057,  -56607701,   319902811,   960858771,
        -423030408,  -812161836,  -1112301146, 132484238,   1783289397,  -2018957458, 450584409,   1012115988,
        -2101400823, 1667035362,  1107203875,  -1865977929, -723361763,  -1343871789, 1135679266,  -1675492453,
        -140706303,  1364740541,  -1551211173, -2009393394, 2000971427,  -344052593,  462623413,   143090848,
        -1640955654, 1157518396,  659813664,   -165571783,  -761091080,  1439584252,  -52830785,   -1885945630,
        1884406245,  -555522218,  1323853722,  930747959,   137706091,   555548831,   -1337759477, -1009674506,
        -1977870785, 1180081172,  -687421630,  194151065,   1311924712,  -866937125,  -137781558,  -698706859,
        -1895205467, -1848499551, 1896490516,  -6509636,    1269553250,  186532024,   -955818569,  1845517066,
        -400727025,  1078611153,  863814973,   -1229137047, 1718754324,  -216510561,  1988750453,  29465919,
        1428890551,  -62281515,   -937668540,  -1508270436, -927907488,  -505451885,  1033857489,  -389957828,
        -2065486196, -352295525,  -2105963968, 1299134698,  816779483,   156423679,   -1354381381, 1887465750,
        -2105822745, 642600242,   1123616314,  188710252,   -1703216607, 1459661161,  -1941560289, 601336479,
        1863482085,  -857985266,  794305967,   -1660447453, 226783646,   241199673,   583367867,   849630317,
        1914170489,  565711020,   -1488638620, 609086194,   1720536967,  -1694564352, 692492707,   -1506800749,
        730802235,   -157471351,  242744029,   -164780657,  554729192,   826406260,   2052603794,  1509424364,
        880799424,   -742089480,  -1122708577, 1850636033,  1672099719,  1908731732,  1738334895,  -2040611202,
        1682998097,  1398609974,  -1324949149, -975919403,  -1450888087, 1833224637,  -619514125,  -990582005,
        1412067944,  886169183,   -391523199,  607372595,   -1262130460, -1519841199, -1773159746, -1708684329,
        1508540061,  -445129927,  -861216001,  449901651,   1557438209,  -1188736704, -630147206,  -679376511,
        1198115538,  -382787307,  697875997,   -22939436,   239787497,   500731101,   195546534,   1392914720,
        -187209041,  455847608,   -2049957759, 766204445,   1368826958,  -2042625013, -180992444,  -713812831,
        -114800611,  -607409323,  162793232,   2138008530,  -1531267188, 868044052,   -1630059848, 1621859247,
        -1597211643, -1129166747, -1199701638, 1770783044,  36166445,    1439401965,  -994866018,  -960772827,
        2001685784,  441293150,   408861924,   905891633,   1537313206,  400637893,   61265814,    1571963795,
        838433145,   2065601099,  778646834,   316955585,   -2087195141, -1175880744, -1556081321, 1057881099,
        261925029,   1208410025,  -1666750702, -1564870443, -1780046839, -921180273,  1249930686,  22741986,
        1111587522,  1806539596,  -2004101869, -1217186294, 1838807150,  1025186692,  1739799205,  -970775152,
        1248070355,  -507661275,  1255915477,  227039459,   -1806354804, -1933273622, -1702447540, 998405321,
        1478470466,  -1376315847, 30712562,    -2027352328, -1528293401, -1983304959, 504320567,   1291680060,
        -1444744047, -1127727805, 1549237293,  1204875828,  -290551371,  1890491263,  -60192594,   -338589164,
        520299155,   -1570639410, 1365342605,  717971876,   2100041137,  950014485,   2111827591,  -1614588413,
        1565446784,  -711540009,  -612602607,  -1878381653, 759406734,   -1354242425, 1036377793,  283764256,
        -147639272,  -280351513,  -314754805,  -993828539,  998353033,   -1202064568, -1057618001, -395391049,
        1549721165,  -598972723,  -982907535,  1557165381,  1891640427,  654353458,   1775642645,  935383528,
        -1688413182, -419838142,  -1817002350, 1500587707,  439484714,   -671255505,  -1446765092, 1379929086,
        284924340,   322973021,   517663367,   1269409562,  1635098653,  -456602725,  216521789,   -390880857,
        22702718,    -141949792};
    EXPECT_NO_THROW(r->set_i32_2(AttachRRArray(i32_1a, 946, false)));
    int32_t i32_1b[] = {
        -461364931,  -881174363,  1190512124,  -652344200,  -1904465790, 654215830,   -8237446,    1554134258,
        -1171405181, -2097329372, -1168547037, 4964041,     -162499187,  -1566779923, 396658647,   1372847452,
        1952977117,  -2055030887, 1369558008,  1159869637,  -151488968,  -1230916956, -1662654082, -692556634,
        -2108882739, 1919783279,  86726599,    -479175753,  368307099,   263085896,   -1297854452, -475865862,
        -1052798892, -195216089,  -1808717864, 1435851230,  213845163,   -2014435943, 1958739019,  1950538379,
        195043354,   -2094251280, -552928187,  212026163,   1882789473,  -1701156512, 700729029,   617009319,
        -51379635,   1437981860,  143582562,   1759700160,  -1043283958, 790685144,   1053455552,  888961142,
        1884764193,  -574487120,  205387093,   1706716858,  -1564706331, -1119162850, -320357115,  -216356729,
        1133115157,  -1585595150, 1163420546,  2095530513,  959051309,   1266503031,  -1940662617, -1207768369,
        2071048923,  -247500208,  729695364,   1732441574,  919515230,   -1307758899, -1362232635, -985845056,
        1183002178,  -967666429,  61839483,    -797969544,  1019207261,  -2080745651, -1493399698, 448039065,
        -1006260032, 547484182,   -433873666,  -145482008,  1266128764,  -374269118,  -148627528,  -481205875,
        28560825,    1620567461,  160877005,   -152736921,  566726869,   1690610724,  1551218429,  129384906,
        1756514951,  -1619123979, -1635458102, 461420293,   -1025697720, 1074881682,  -1342853402, -2024581138,
        -1021476707, -979756855,  -2061951658, 495595484,   1072057242,  -1075816975, 634930689,   1462757877,
        -355459145,  113806554,   -1586994022, -1759236007, 1642313755,  1844726616,  263774839,   865591847,
        1137711548,  568540382,   1697402204,  1287333602,  -18557107,   -543522023,  -747044673,  -894978937,
        -1633590316, 1469569043,  -1916659051, -245350462,  558791729,   -1069756095, -1671183103, -675709621,
        -1496240619, 1002596182,  -1049603233, 1067628357,  -320684962,  -1756926613, -1978637534, 2115134917,
        293851213,   188870457,   -2033713174, 316694162,   -1680926305, 1578104820,  2019431451,  1672278268,
        518272185,   -366138444,  1261822504,  1003789835,  -595796762,  -1764183978, -1066900678, 1415600408,
        -173332206,  341584118,   1836086928,  -77555270,   -1989963843, 428500682,   -489840295,  -1096671034,
        -1915424250, -1746745758, 473428620,   1155878488,  1534484342,  1866809635,  2125417205,  -356683367,
        -724519561,  476765866,   -509611460,  1067343485,  -1663160103, -1973204454, 1891962125,  -1486851183,
        539703058,   -78175960,   -1038870474, 585234261,   -1015599511, -1860840029, -1939494917, 2120890829,
        -1396051426, 442584714,   -559475888,  1852553473,  1370937853,  -189979498,  -1942748392, 575014321,
        -206759426,  -31154557,   -2070305927, -1863241823, 976830155,   405210820,   -1810403626, 1246769487,
        -1690543149, 1313271912,  -351123144,  -169833423,  329135592,   1471013659,  1018659812,  -1227714342,
        -191860948,  -1335651686, 883360682,   836140176,   533570354,   -306737045,  503171813,   1574245195,
        486740175,   2103577114,  1369514515,  631086314,   -1519000748, -1651625120, 2072505877,  343400009,
        1919137338,  1103988337,  2071554186,  150773570,   2097705645,  -130202734,  327475069,   -884235865,
        52111222,    -1080547500, 682409781,   1559839293,  -1958998234, -668500619,  1652828958,  1898194722,
        1411170984,  2027809940,  2057915321,  624976316,   -1590230095, -39277437,   -399063086,  -199887533,
        1695889089,  -179411470,  -814891514,  441001215,   228328910,   1969824685,  1673102538,  -939256124,
        -2021849575, 1292458519,  1963232860,  -701199322,  1898059105,  -2045458245, -896773856,  -465102206,
        -1132267068, 1715928377,  -1576771507, -76241412,   1187144803,  -1067322651, 570283207,   1328683328,
        1679817753,  1351131251,  218112167,   1288274663,  1769551475,  -1459879021, 907399627,   -129113618,
        -816814174,  -281922806,  1308242407,  959061391,   -643658909,  -1586885260, -731576338,  872407494,
        -1435528398, -978470065,  561011867,   2094464646,  -1961457104, -370593344,  173444003,   -1787659154,
        1403917210,  1314481998,  -2064760703, 627159779,   -1209896425, 950681678,   -1599356229, 1797678336,
        1407713282,  -1860763990, 1818135625,  -797982794,  1766490463,  146950743,   -573489171,  541336457,
        -786031692,  -823206893,  472702619,   301835709,   903962039,   334036788,   1308489144,  1982571588,
        -1297489003, 1027291239,  -1050223998, 1301065587,  -131811840,  840706119,   151612697,   -1514662009,
        2045477247,  -78244632,   1428738052,  999845946,   632205998,   -2084777797, -1263080892, -1527740973,
        -1052672864, -1148385231, 2118437588,  64244951,    610247700,   -192213951,  -1677840790, 695619117,
        194487568,   -1064818224, 567953693,   -556351633,  -358984117,  -543035561,  1299534234,  -1814192015,
        -1987974286, -251589327,  -1550216573, 1039391427,  -648231381,  209808513,   -1809205905, 425289643,
        -1478441699, -499830484,  895438284,   1388891777,  -141187536,  -1921173432, -2109700894, -629643543,
        -1992180854, 1262181466,  -1000112113, 1891981448,  -511356474,  678112000,   231308715,   -845426086,
        2065931343,  -690231821,  -2065441467, -497137258,  -288817447,  -272642500,  -1778307241, -206926623,
        -1058833162, 1207480823,  -577760388,  967667904,   -747757357,  1515713516,  1901169583,  -43384102,
        -1869097267, 698722931,   1723948263,  895747277,   -963077288,  2007160291,  -1139652897, -1941673179,
        1182316407,  -1504345279, -69517474,   -1337091986, 1144745436,  -295343637,  -368530206,  423117467,
        -1160707313, 606107242,   973575490,   782358427,   1225701496,  1354180679,  -1819084457, 210496900,
        -1607248517, -100403486,  357128435,   -1211000784, -1699635523, -1995757335, -2041727997, 1639346630,
        -1140917407, -1428441321, 1391552530,  950439976,   1536850187,  1755763383,  349315024,   -1716747422,
        1788059719,  -956787148,  435093165,   -519717781,  -1185043774, 1326150846,  666841562,   977518902,
        -1878116663, -1052216208, -159814671,  545626237,   -1161390691, 172913262,   -1143147285, -711220581,
        -2073758388, 1347605160,  -274461216,  -1138600943, 1812589913,  1321776791,  -654185814,  -514865093,
        342576025,   -1227661029, 2027182643,  499090278,   -1057042386, -1200362684, 1633068952,  1127338030,
        66338457,    1655244407,  1091076049,  1868857534,  1902975017,  427968982,   -689633450,  1869590905,
        828919724,   374348665,   291496172,   369492724,   -1956000730, 149774736,   -283502913,  542857976,
        1810830261,  1711344293,  -1158072113, -1788295198, -314318981,  -1029216204, 1180472328,  -769273193,
        -1884508206, -1558495607, 19086583,    2059341589,  -1133755497, -2103950715, -353373479,  -330597102,
        146329926,   1139012057,  -1595155154, 92242787,    1758776536,  -2142059846, -1016391823, 572794885,
        -1164070685, 936895954,   -530252487,  -852015578,  -1387262267, -610552571,  993685216,   -2060482368,
        -54855358,   -1368415548, 1727532083,  -1998919251, 1004938093,  -193604754,  402127614,   15533913,
        -822374248,  914869992,   -398825428,  -1951818825, 1024562104,  -1513050369, -1086194365, -1602294388,
        506250848,   -450950473,  -1107350963, 724811630,   1667267553,  -1296578611, 1797492484,  1593191271,
        -797438732,  -1327763127, 1815794923,  968830944,   -1597687229, 453031735,   -311267208,  -1363949093,
        -680526092,  2111164100,  1874373703,  -737231277,  -1941054345, -1943683241, 299275156,   -777764717,
        -1580845667, -1590831315, -706883071,  1006664100,  -455650726,  405499155,   -1557738572, 1434435376,
        -476662082,  -390599384,  -1023097080, -462139722,  1416922513,  -1243778374, 1721356353,  2052478481,
        1576465185,  -1753145409, -1866886190, -709091910,  1188370346,  -47903041,   833750418,   -714362080,
        -1356224125, -1264932342, -2019192812, -1865286029, -872940604,  -1103730145, 960420100,   -1042876502,
        -1376735106, 652488617,   265536834,   -727122450,  -1304252301, 1452309463,  -345462904,  -1385578434,
        1005791488,  -1952157450, 1535232809,  1539175065,  1764693654,  370125766,   -1202518768, -1045824063,
        -1277351352, -209760871,  745809202,   -969253860,  -263968717,  -1987049520, -994220477,  1014895379,
        767424874,   -1455749768, -1031331847, 102844430,   -1853475234, 1375464119,  -36893052,   738438714,
        -2023227099, -766955665,  917641510,   2098209786,  -1217824087, 1658975849,  519874226,   -253260859,
        -1162718483, 1786747123,  -1141951794, -2107503630, 454499128,   -1967565552, -1023321135, -1996284503,
        -752431392,  472701630,   -1632851902, 410108660,   -1046454863, 1967316776,  855860213,   -1312902400,
        2040315518,  -1117439624, 493239897,   -1998091182, -2034474271, -1097999735, 1318127173,  606300235,
        1842233668,  575662433,   -2004034017, -453132858,  575442626,   312602259,   -2052800210, 1864640938,
        -1558226144, 1723181891,  1563560258,  1335087794,  1484455993,  1617896015,  -1725417335, 1319720221,
        -1761963217, -699139792,  -1289651408, -1107156983, 1743906484,  -4909723,    -1308860494, -1458950358,
        -1346838156, 770842123,   -2015270071, -24732450,   1317412484,  713576473,   -367369916,  1304052776,
        249082034,   -1501300599, 440635569,   -1918514505, 1703744454,  1979510875,  -1459719502, 2080733946,
        1591601168,  -1279512428, 1050916259,  506633589,   985141457,   -1785288990, -264273336,  -929708322,
        -719186799,  821741784,   -672362448,  552181928,   -802373915,  -390543422,  -343050866,  -1958288614,
        898584575,   -2009826787, 695541207,   -490634204,  1677702760,  -881113644,  949838036,   -1754707531,
        1625802700,  -2116565724, 1986923158,  755539119,   -1478875610, 266787239,   1794560040,  1005034935,
        1558408357,  763790383,   677517420,   2072139195,  -235728628,  1725705385,  -1582053707, 1113461586,
        1674642759,  -1414719663, -608468252,  -1873260761, -1401304493, -1029303396, 1873534265,  912963743,
        645715337,   1132031991,  487696799,   1110621999,  1383752223,  1018103642,  536280867,   1764666589,
        1624759145,  -707782673,  1407012132,  1887436609,  568473975,   -758524638,  1093808445,  330404853,
        240981075,   -250484760,  498674002,   -1126343191, -1070540555, -17257403,   -1302522037, -1500566183,
        -706742387,  1731391627,  -121892623,  1944180,     697150366,   1175869801,  -1081726694, -772936078,
        300113930,   -1519743318, 1011619084,  966435032,   -271530967,  1478437384,  -2000885569, -1625488897,
        -30409891,   -577640443,  -491669659,  1721990364,  464531779,   -1035520457, 1234811766,  58268492,
        761680308,   338102126,   -1281454585, 1554633851,  -2008859178, 55616722,    -2039496630, -902950403,
        673529549,   1020509295,  1518665847,  -478044459,  -296723364,  -2075845731, 1809506854,  -99500436,
        883142933,   289332182,   738556337,   1501633470,  2058318873,  -346819242};
    EXPECT_RRARRAY_EQ(AttachRRArray(i32_1b, 822, false), r->get_i32_2());

    // int32 huge
    {
        RR_INTRUSIVE_PTR<RRArray<int32_t> > i32_huge_1 = AllocateRRArray<int32_t>(2621440);
        for (int32_t i = 0; i < 2621440; i++)
        {
            (*i32_huge_1)[i] = -i;
        }
        EXPECT_NO_THROW(r->set_i32_huge(i32_huge_1));
    }
    {
        RR_INTRUSIVE_PTR<RRArray<int32_t> > i32_huge_2 = r->get_i32_huge();
        EXPECT_NO_THROW(EXPECT_EQ(i32_huge_2->size(), 2621440));
        if (i32_huge_2->size() == 2621440)
        {
            for (int32_t i = 0; i < 2621440; i++)
            {
                EXPECT_EQ((*i32_huge_2)[i], i);
                if ((*i32_huge_2)[i] != i)
                {
                    break;
                }
            }
        }
    }

    // uint32
    EXPECT_NO_THROW(r->set_u32_1(1550099195u));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_u32_1(), 547919123u));
    uint32_t u32_1a[] = {
        237099665u,  1725693514u, 3671290215u, 2838122575u, 2174235839u, 1926762547u, 837710207u,  2675306390u,
        3296759548u, 3236712776u, 1185582523u, 3424554628u, 2120088772u, 3672727628u, 1229489468u, 299615394u,
        2391828662u, 2161918065u, 3215046430u, 4090719326u, 4046969338u, 2837195073u, 1814520605u, 3281278603u,
        2366669618u, 889646058u,  2889818005u, 582950935u,  1660657214u, 3304485267u, 3017091402u, 4182786222u,
        381383578u,  468232037u,  4264726246u, 548129943u,  228487325u,  1626908942u, 3843628003u, 340032714u,
        896193553u,  1589965383u, 421647904u,  1025804481u, 37483739u,   314532432u,  2655347560u, 117434633u,
        503953090u,  3976906518u, 1323855325u, 538108471u,  4161859424u, 1912643799u, 1352908924u, 3415941572u,
        2123957567u, 2125372546u, 3660361032u, 2093953170u, 844556942u,  350952258u,  3712309630u, 1671728833u,
        1515702177u, 674196370u,  1804290265u, 2369213421u, 659681625u,  3007121556u, 3629421992u, 2355746396u,
        1887771u,    1763854265u, 3669589284u, 3060951582u, 2289752966u, 2753656458u, 453476287u,  3858397040u,
        1755557022u, 1056528532u, 1074824037u, 3392115327u, 959387159u,  4047339053u, 4055444899u, 2701521116u,
        3269246259u, 1658313101u, 1191016218u, 2976266754u, 4058115909u, 3148745595u, 2255966436u, 1286833652u,
        3846605743u, 332980236u,  2987111809u, 2863137443u, 3589002629u, 3634508729u, 3050304267u, 426166523u,
        38644952u,   4120741158u, 3779249472u, 2247004208u, 3887627978u, 771737466u,  327488668u,  2413511241u,
        3742352323u, 1800531129u, 3093397506u, 119855689u,  1044449337u, 1621589532u, 2435672368u, 2249934961u,
        2486385468u, 2733265378u, 2055466545u, 3463839050u, 1741434858u, 1937180913u, 53147295u,   380685724u,
        2147133772u, 3377145922u, 1696161493u, 986108230u,  552797714u,  1030805428u, 3633258771u, 724378483u,
        1453096552u, 3633745301u, 722493301u,  3218821892u, 3672842476u, 3232339885u, 2194639207u, 3626117658u,
        160139022u,  1220950174u, 1499215195u, 2900860877u, 1105932921u, 2513047638u, 2975567394u, 2688547895u,
        1701949245u, 494851022u,  3099438803u, 2302405511u, 3002890773u, 3694596195u, 1818301109u, 2241585621u,
        3375937719u, 2173718080u, 3174769392u, 2332849203u, 1120354034u, 3688107993u, 3910547603u, 475511452u,
        165704715u,  2543590060u, 4279301981u, 308235882u,  1816022030u, 2611287885u, 2638354900u, 1603444131u,
        2625463614u, 2748122332u, 2695819720u, 3508062749u, 4213882116u, 1456900955u, 2527945808u, 1021825166u,
        2050461441u, 2014465404u, 1165369542u, 1735932899u, 3460204932u, 1482933068u, 1853558960u, 3796877889u,
        2819245867u, 1495722807u, 286085468u,  1232127264u, 1369041740u, 1203310608u, 4013214417u, 3662137316u,
        3906425458u, 1886277730u, 3592347464u, 4124894145u, 1520615672u, 2057935984u, 2780423261u, 3807868959u,
        1096708615u, 1133308613u, 2081283278u, 3031731081u, 777297905u,  728628197u,  1045968931u, 2798986608u,
        1441163940u, 425803298u,  3425923673u, 3174138272u, 225290447u,  2789342514u, 1500710940u, 2214009944u,
        2611052505u, 1511169866u, 3468976229u, 887023337u,  3301621653u, 348051316u,  3413528372u, 688050819u,
        3270149113u, 2721404891u, 2790531383u, 1307526009u, 24196953u,   3323021735u, 1883300819u, 827261292u,
        1024782357u, 4200877565u, 961985674u,  166365221u,  3011947146u, 3773678739u, 3122249899u, 4236359826u,
        3567170538u, 164427914u,  3384429677u, 3901604544u, 3178054797u, 1736839253u, 2964545385u, 891428101u,
        1944593339u, 1989423560u, 1361523913u, 3168022842u, 3512787479u, 1890231449u, 1593427930u, 4149710413u,
        206469070u,  1896704648u, 1231454209u, 4068940405u, 3271655038u, 2008435184u, 2914967896u, 2357818161u,
        1859278865u, 3410094777u, 1298228364u, 222292372u,  1055108733u, 4040689906u, 2210549194u, 1948747u,
        2506100330u, 962472296u,  1968083925u, 113875684u,  1936131419u, 1016307414u, 1060859451u, 1739828182u,
        3346648079u, 1164081840u, 2485888280u, 3476085289u, 585721471u,  390929102u,  517669802u,  2653223889u,
        1174053498u, 1569525180u, 3310507972u, 1002962122u, 2262804195u, 3220775546u, 3182459697u, 2156503148u,
        4131684371u, 2813459977u, 1117022498u, 1997829290u, 2683851565u, 107074302u,  1419327824u, 3915955155u,
        3780878619u, 610899511u,  1901058671u, 4050293718u, 2053491262u, 1391571066u, 1177627511u, 743398950u,
        3803305715u, 194123827u,  3621325995u, 472267748u,  3375152783u, 2897163902u, 3462255512u, 4250233830u,
        3994919468u, 2831376517u, 246739001u,  2563541164u, 2158887230u, 3637942716u, 2966210109u, 47815115u,
        521677298u,  645694605u,  3228944885u, 737962495u,  826169136u,  3548976344u, 4043510480u, 495863083u,
        777697689u,  805624668u,  1263172222u, 3510345575u, 1056092728u, 2969537722u, 747239264u,  3369168528u,
        1344872701u, 3335255317u, 4214479629u, 3890217901u, 212326383u,  626667851u,  4084223303u, 2815290146u,
        3385778156u, 1708926854u, 295550151u,  494270470u,  3067952778u, 1533064310u, 2934900292u, 1705387163u,
        1307922285u, 2193031516u, 2433387564u, 439649015u,  2639844157u, 3899988054u, 3512645808u, 4082111285u,
        39460185u,   2109679546u, 2807623639u, 872015072u,  980218181u,  3396910791u, 3668142418u, 1001890199u,
        3235923562u, 3566499716u, 363410876u,  2673237222u, 573356352u,  1636136151u, 2224553312u, 3704628010u,
        1623877736u, 2563570732u, 1232767726u, 2971775467u, 4216718036u, 3488020769u, 257411122u,  1168087703u,
        818565641u,  900860168u,  1947568647u, 164818961u,  3931611634u, 3720231207u, 2690894061u, 1424779930u,
        90538671u,   131364160u,  616530415u,  743044912u,  129491467u,  4041759658u, 3433286148u, 4169430938u,
        2922959631u, 3821215730u, 3097046213u, 3611435200u, 2326824436u, 184884915u,  2069988071u, 3914342196u,
        106319212u,  1325869172u, 3906567559u, 1758481342u, 1277175140u, 2754342337u, 1294820705u, 791996734u,
        41241012u,   3345622322u, 3718866993u, 1255338839u, 1391956142u, 3839078475u, 3457508262u, 551513656u,
        1004850662u, 3795985935u, 298265118u,  3742037297u, 3355517467u, 3601723593u, 3585988041u, 3063759488u,
        3171470181u, 4259702765u, 3239000394u, 2708065681u, 4092601030u, 346908933u,  849213263u,  2851377667u,
        1796454246u, 2735073999u, 2777745491u, 2294240001u, 2121652435u, 2706284022u, 585848169u,  1936702478u,
        2371114722u, 1541583037u, 116304242u,  3676364969u, 3879455349u, 3833621771u, 3701696564u, 2780518089u,
        1479844512u, 1789233460u, 2165430981u, 3709637684u, 1215700310u, 3383152932u, 2134182167u, 3267525810u,
        4142614062u, 1913035686u, 299460925u,  2677124325u, 2261142050u, 2007429043u, 515722793u,  25703755u,
        3410497288u, 1661381183u, 1667524384u, 530887788u,  3517835794u, 159256235u,  3805603779u, 2368397u,
        2999883232u, 39771046u,   49747199u,   3734347231u, 185140859u,  2259304947u, 3389847559u, 3758478898u,
        1438981583u, 1923428196u, 4294696986u, 1917080172u, 3599354053u, 813437110u};
    EXPECT_NO_THROW(r->set_u32_2(AttachRRArray(u32_1a, 510, false)));
    uint32_t u32_1b[] = {
        4251946440u, 3334867394u, 1627635129u, 2588419147u, 4174027116u, 3897125158u, 80443814u,   1389733726u,
        4117149812u, 12542280u,   1256007817u, 1703348194u, 4237384057u, 1454512978u, 2775061970u, 3298540861u,
        3715621276u, 2362002640u, 3636980763u, 3430743390u, 1830381203u, 1507092396u, 4142499824u, 4213673901u,
        1183960426u, 1874370435u, 4181283334u, 2200901254u, 3332790298u, 3423644529u, 2387935836u, 952382132u,
        3924524172u, 3719680299u, 853249098u,  4083610173u, 2636543308u, 657361882u,  1525744446u, 376298547u,
        2451684942u, 3240929540u, 2310416762u, 730671377u,  2937427586u, 3563592349u, 2472196520u, 2147357762u,
        914655107u,  1758244054u, 3876886042u, 12351564u,   1679162795u, 1489623257u, 2455794558u, 2538372341u,
        2057637059u, 3508778762u, 567682489u,  283434754u,  3167627543u, 1915532592u, 1232942381u, 2754609078u,
        4150346060u, 1663219004u, 1231896519u, 2755959635u, 183820585u,  1055352125u, 2147188623u, 1645909010u,
        1893712235u, 1485051038u, 870164520u,  1966826561u, 48501444u,   2556720793u, 3128066451u, 790988700u,
        865202135u,  4263049716u, 2090861867u, 1748977625u, 2699841095u, 113797990u,  2481195137u, 2574284167u,
        834141103u,  476065944u,  1480757910u, 315080683u,  350708905u,  338916974u,  709575589u,  3077697353u,
        1231129412u, 746021816u,  2332229547u, 1946675456u, 583346238u,  3135681244u, 1842291655u, 231618544u,
        104978643u,  4086067348u, 3174792638u, 1543369889u, 1101673653u, 3023672083u, 3205010661u, 1536466390u,
        966572661u,  3883854770u, 3427219648u, 2247096744u, 4079126348u, 776176295u,  2599372279u, 1888032134u,
        360725842u,  3052443662u, 865793013u,  3084628677u, 516162558u,  1020425629u, 2915535067u, 4215116317u,
        2977464272u, 1660722837u, 3507058298u, 864890045u,  249379031u,  3973345746u, 2629825645u, 771115239u,
        3526813236u, 3106614042u, 203525488u,  2971666751u, 2845337507u, 1637317812u, 1743782319u, 3991795965u,
        3057486763u, 2839184028u, 2831552101u, 2836007599u, 14115933u,   2147447119u, 3904004068u, 3346997713u,
        1322155226u, 1049159718u, 2520132354u, 2765453431u, 4205328777u, 4063219623u, 2238279021u, 1619016803u,
        415896490u,  3591765870u, 3318597287u, 1557289292u, 2845067684u, 89482247u,   2114516871u, 3464828768u,
        1114311788u, 4215401081u, 3458358731u, 2736518275u, 380431203u,  3435888629u, 4249714953u, 1764633576u,
        1915821483u, 1597234883u, 111251916u,  274107180u,  2935452271u, 4072034355u, 357724805u,  1550422867u,
        1378849275u, 3264188640u, 3028697235u, 2805673388u, 656257910u,  1454961285u, 188865944u,  1924561757u,
        3184772136u, 129725152u,  1587697966u, 106462817u,  1587951867u, 3192757556u, 2829152265u, 3270745049u,
        435873692u,  3749929242u, 2062096658u, 4149869860u, 2418404390u, 3646774382u, 343128996u,  2496743364u,
        734565947u,  3826051517u, 2828517029u, 962692901u,  730853036u,  1082602175u, 298823790u,  3231844899u,
        526460170u,  2579457360u, 1480606553u, 1842946907u, 2622701868u, 3895551897u, 2026981125u, 3153668454u,
        3704749050u, 1185971623u, 2504477989u, 1870109318u, 1518600621u, 14687749u,   3846239097u, 2613355571u,
        4011868731u, 4273118207u, 539188665u,  2099254272u, 1043640546u, 2517454961u, 4147146631u, 3753370580u,
        3811721724u, 989962603u,  2211483632u, 1480428764u, 1954557704u, 1112461942u, 1569266181u, 1678583802u,
        1646459706u, 316406457u,  3242999591u, 3888012390u, 2402113654u, 746240298u,  3662473135u, 1260156363u,
        1203238376u, 3061859356u, 2032152659u, 966717679u,  2534194659u, 3388402620u, 3223059378u, 3877902454u,
        2566178070u, 4108564664u, 2578614366u, 2924743698u, 3967226306u, 1346866215u, 4129141259u, 2159606690u,
        237374413u,  2311773278u, 2936435723u, 1669343609u, 3835118141u, 2474006294u, 2312776854u, 3991958455u,
        66050323u,   2021998927u, 3191454066u, 2189188580u, 2142686591u, 262029985u,  1334540897u, 877178233u,
        322292574u,  583880104u,  994626866u,  2643853709u, 2746736170u, 1819097952u, 3500683162u, 2717819610u,
        1979841756u, 4158317627u, 3768907483u, 4144867490u, 2428342768u, 407254584u,  3876466370u, 2906963449u,
        2747730439u, 2807429483u, 390805623u,  1347724002u, 3708124771u, 1996426487u, 209852741u,  3539291907u,
        1973958470u, 930781564u,  3333035683u, 555854849u,  540149787u,  3214341438u, 1165683130u, 284698251u,
        3229514555u, 1944044250u, 676799831u,  3415601775u, 686883721u,  2475380401u, 2417075124u, 1731220395u,
        2692854334u, 2090593377u, 2377595670u, 3031508806u, 24480902u,   3556421449u, 1940400454u, 3751271557u,
        585927728u,  2399018121u, 1897248871u, 4110307692u, 1294121928u, 2976700231u, 2519149970u, 2393660481u,
        1452332020u, 1320620207u, 2261085851u, 2445477360u, 3141380218u, 1044718590u, 50521930u,   112491419u,
        4149332237u, 1091423792u, 1469962572u, 3907732209u, 3328879500u, 4063642960u, 3006889620u, 425720040u,
        2842213341u, 2094386140u, 3171166176u, 757382335u,  2515418722u, 2466505128u, 4181749776u, 3386253778u,
        1241141486u, 3110299582u, 599382492u,  3361936057u, 2904521896u, 3463235864u, 1686895148u, 4096837571u,
        2649784396u, 102145162u,  4034413105u, 1309891308u, 1727749117u, 4111125789u, 3485689078u, 1298526747u,
        3208723720u, 1387080573u, 3497204630u, 2701756222u, 866112144u,  3332181807u, 2824696606u, 4019789661u,
        1393196838u, 477838543u,  3838343203u, 2399752805u, 1676970714u, 2163423971u, 3918831727u, 2082667742u,
        687058482u,  4132123776u, 2944329588u, 830337633u,  3305684867u, 1115400173u, 1409924819u, 4213431551u,
        101974285u,  721035281u,  418956469u,  3537419424u, 3058980494u, 3735712173u, 31898322u,   812527641u,
        1412975070u, 214035881u,  3370497326u, 275023508u,  2188096928u, 2698269714u, 2338536560u, 2217867267u,
        780724394u,  168999967u,  4028242661u, 2057116599u, 248770288u,  142100118u,  558526929u,  367796080u,
        1613088719u, 111252491u,  569035372u,  2444968023u, 4163888313u, 3008206018u, 655301551u,  1102089047u,
        2157711351u, 1189565715u, 1048858627u, 3463105328u, 1659606364u, 2839652561u, 311401265u,  297227948u,
        2049718821u, 1287086069u, 2816817582u, 753298510u,  79123064u,   2058422267u, 1988231070u, 1697021200u,
        3755875481u, 2000787653u, 372680790u,  770642272u,  3557979977u, 3242763045u, 3424268849u, 2545039983u,
        3403101537u, 804431778u,  3022051943u, 1799982329u, 835187866u,  1307679719u, 795446639u,  2865087004u,
        2503099400u, 1097854687u, 412079412u,  2918593238u, 4204336449u, 3272876881u, 3701287131u, 215671154u,
        2729194459u, 3828900376u, 407889473u,  2386020434u, 1672155598u, 1588439879u, 2355888880u, 2451706408u,
        2223568426u, 4230924842u, 1121564168u, 3971399371u, 2302823247u, 1838239260u, 4017581704u, 197226193u,
        1773201901u, 22730505u,   599013585u,  2360399780u, 3459055993u, 2359729316u, 2534122212u, 3338162386u,
        681551474u,  804682591u,  3684776026u, 2611917837u, 518924291u,  3527933723u, 2831363989u, 2092857661u,
        3011292035u, 2036768662u, 1165948954u, 3915111934u, 3715091842u, 3486642823u, 2169348932u, 2210412086u,
        2082504433u, 218262071u,  2666551070u, 3844955859u, 1885787522u, 50919684u,   30300958u,   3237830009u,
        1004399278u, 1420324202u, 2995067867u, 3343455201u, 1341482320u, 2707911315u, 2322962795u, 104691279u,
        433113543u,  1673935915u, 237192280u,  3866873407u, 3719846074u, 504926120u,  1585743054u, 710382710u,
        2276436306u, 2976938826u, 1322735386u, 1856969923u, 311925360u,  1497000075u, 2852252785u, 207694370u,
        3237126868u, 126779936u,  696212993u,  3860732454u, 2811018481u, 3182218492u, 2694262689u, 954054185u,
        1145279765u, 1827792779u, 647535690u,  2378645894u, 1603060963u, 1501639457u, 967601596u,  3979534574u,
        2129057469u, 1503074666u, 3455573355u, 1277747107u, 2364423785u, 718418781u,  2029920441u, 3230465514u,
        3292224990u, 796319542u,  4143628522u, 2357283776u, 3321794845u, 2371483975u, 1136784117u, 2757314460u,
        132067372u,  294498845u,  2989608361u, 1147501898u, 848670725u,  3702484846u, 3398317762u, 274118355u,
        3486956662u, 2414417547u, 4165976855u, 3707418163u, 3614978249u, 793009306u,  4227283826u, 2072607460u,
        2291123052u, 1319566667u, 3736885972u, 1075733989u, 2822123350u, 883768237u,  165340447u,  2283477403u,
        3854687889u, 2702364501u, 261781101u,  4253180939u, 1904200988u, 3670999235u, 2081253795u, 1013385256u,
        3393606543u, 3915738401u, 3677841368u, 2222722431u, 3582521284u, 2184635962u, 1379820344u, 4132361812u,
        3076369748u, 3111110095u, 1060089765u, 3951504597u, 276119608u,  4292130693u, 1208342406u, 2964718231u,
        1156835032u, 1503506724u, 17689181u,   1253790050u, 2052448727u, 3951262449u, 1045066741u, 1212371757u,
        3864687390u, 2781636814u, 4164334487u, 1434750495u, 1015217609u, 492107542u,  4106176432u, 4258301116u,
        52857279u,   3601017578u, 553436516u,  1286022350u, 2970181802u, 1531473162u, 615711544u,  2770114226u,
        3807138554u, 1254115612u, 405024141u,  2248962327u, 3661682788u, 3457720992u, 2391719239u, 3782958744u,
        3184983441u, 1120404266u, 1505151243u, 2382314268u, 4164517871u, 782247452u,  923774834u,  3508260701u,
        2537984828u, 2116287910u, 3255992169u, 2640296699u, 614769200u,  767427138u,  3456406779u, 1809700841u,
        2437468993u, 642938299u,  3155191374u, 4074085350u, 2642920857u, 3189984175u, 3169851773u, 4086000673u,
        2490375684u, 3948311217u, 3105674217u, 1698869289u, 1311043867u, 193634359u,  3011562913u, 4136987101u,
        3694637471u, 3746665664u, 984905715u,  1842085529u, 2014624560u, 1012559384u, 381626366u,  3316965712u,
        3951018504u, 1396133012u, 2477956684u, 3892489603u, 2447107565u, 1585934707u, 2614794953u, 4048636321u,
        697301886u,  2382428822u, 2964257243u, 506994596u,  1901393962u, 3958702238u, 930275666u,  3970480891u,
        2137671677u, 911161575u,  3800494155u, 278586712u,  1193762952u, 154795879u,  3301269187u, 1668521332u,
        444082092u,  1753908500u, 1687735396u, 3236812133u, 2861130228u, 179908202u,  1539423798u, 1280312575u,
        1354412234u, 890265444u,  3698680851u, 653081540u,  3681719879u, 838283359u,  969405299u,  1918696509u,
        651424255u,  1081467498u, 1369194422u, 969636592u,  1353343686u, 1151142771u, 622249210u,  2324152022u,
        3419137792u, 2402401643u, 417315756u,  2283635979u, 2730135008u, 945357607u,  1421847419u, 546033882u,
        3198842674u, 3343416782u, 1103542692u, 4192435052u, 2680753787u, 1928123125u, 1829821471u, 3877076359u,
        2319958157u, 1817991563u, 3019027601u, 3350099005u, 122241996u,  2220681659u, 1867304134u, 3903645175u,
        3926484316u, 561272258u,  2924762331u, 1521681554u, 4276247138u, 4264605013u, 3489960755u, 90524145u,
        3924010437u, 2159859802u, 3931840385u, 1622645822u, 3614003481u, 4142324969u, 2557247602u, 4114169094u,
        2832266442u, 1338437964u, 4072229872u, 3375287658u, 2231757313u, 4020609455u, 2396693058u, 2794056809u,
        1622056246u, 3798643807u, 3419424563u, 1469037362u, 3368075234u, 2696057690u, 4239384736u, 2499585821u,
        488059987u,  2262538463u, 1978623658u, 294535630u,  3609960885u, 432048986u,  2518665415u, 576966143u,
        1577963777u, 3672258101u, 1737846056u, 1033455641u, 3049863102u, 414818580u,  2310833967u, 3876593023u,
        1159401619u, 512103557u,  3929750248u, 104744865u,  2294284829u, 700010847u,  3919829947u, 472148418u,
        2495096228u, 1476352517u, 3466719922u, 1423170701u, 1835216137u, 3804324362u, 3156638174u, 218238460u,
        2122719443u, 1475392811u, 4191547266u, 1660363531u, 1752963086u, 814996542u,  1775564261u, 2768667643u,
        1691944624u, 2673873848u, 3717015687u, 4274924722u, 4267842589u, 3218843587u, 4086630122u, 2525920765u,
        2642512022u, 2581476770u, 1587395043u, 2479647167u, 2075617909u, 2220378822u, 1164751823u, 1254817289u,
        3012514369u, 535781325u,  1155411560u, 3470618493u, 3736078399u, 727696447u,  3668735551u, 2540239292u,
        1287246718u, 1034530277u, 3398095154u, 2277784043u, 1007465081u, 2592218771u, 2307100491u, 2280001478u,
        3781351274u, 517873620u,  16783814u,   376212454u,  1269327062u, 2190745862u};
    EXPECT_RRARRAY_EQ(AttachRRArray(u32_1b, 886, false), r->get_u32_2());

    // int64
    EXPECT_NO_THROW(r->set_i64_1(8621740821050813024));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_i64_1(), -1357833931563696072));
    int64_t i64_2a[] = {
        -1418708830105823852, -1357833931563696072, -8308127073437794904, 6203263204523798112,  7076661289157584762,
        -3645491092747259726, 2969229117250121621,  -8403401867791621438, -5706351777107258259, 6979420050019736435,
        1350986631885231652,  -8626678967587677100, 8380704325304801386,  3423582193572197909,  8713973059069583959,
        -4562940403005824119, 9144900318464157853,  -8717799056344934090, -8792498500921807539, -8345039878076898189,
        5201358909840838683,  -3398583150340629128, -5482869438456886726, 1644815108571813337,  7248497692538999361,
        -1178045319005427907, -7220532561583062381, -2882504460577706964, -3460274637164886125, 9053064536664375063,
        -8649931456492292885, 72282480921257410,    3058905063630457969,  8394362105178121659,  8263211448476405605,
        8671703720724529690,  1117912130945798022,  -7392161278301566795, 9070973456367872189,  5064083874137910433,
        -2216141782782730608, 6092600172408194906,  -7328184273434559673, 7340896108422144895,  8041029351530593362,
        3567042073657363684,  6634152186323571334,  -939114094925119978,  3932918768588612631,  2223869457290740495,
        -1394521432769550065, -7708491921728269104, 2558409591077932690,  7323090212396920736,  4463226188281322565,
        -7684442752899854301, 3813932804031799733,  -3061288894555894392, -8926314527654650550, -5483212417699975352,
        -5168152193234004511, -5252714907036148733, -8899682260331039592, -6945672564712903320, 1843836835216653982,
        6265565553002088665,  -9191803385169282118, 824381268893232707,   -4195712559860724390, 3170122388521742267,
        93238405484244323,    -3808714570016938587, 7751370385159261162,  -415651213975075366,  -400640794129234242,
        -3632420176870277542, 2145224332581955327,  8408764257602201311,  -5753925773175608181, 2442171188911603754,
        -718254550700219999,  -5279112326876598860, 7731819115318618935,  7285784364016347384,  6648758251111712748,
        -4965048064766122366, 1799714525316551079,  5808264002475810898,  -521447549589589148,  263148779791826658,
        -1256378489223837059, 3001523551318331984,  -2133704098322946340, 9175731965505830169,  -275510851941027307,
        -3450575930678805596, -4673869135690784872, -2779584507299050825, -6244919930307138446, 5663020090027727817,
        3592337319079719462,  -7699870730217589682, 3427192886285003578,  -566635025493084181,  2780130284244381358,
        3422425913941932991,  -723427948584706426,  -1731222455107826641, -3556462521989327042, -8514332474959779238,
        3681987062303886320,  1266418540216073989,  4892980044242035752,  -5243563662285950589, -8021867029688739836,
        -5712778566201121978, -2133887347488624783, -667985954315002704,  2350239843243973147,  5123432618264623922,
        -271741713269398666,  8726020244487579882,  3802883727236102212,  4050625489658817027,  6873081973971784099,
        -7507676454188557650, -675853520577120389,  4704868291861385417,  1767091830085798988,  1315143445596137295,
        -8400502078442130692, 4250620495159315861,  7743903342313618441,  8236285998949285411,  920705431865098656,
        -2187810178560173353, -5636947816335562469, -8869870121412151030};
    EXPECT_NO_THROW(r->set_i64_2(AttachRRArray(i64_2a, 138, false)));
    int64_t i64_2b[] = {
        8621740821050813024,  -9092072209079113602, -3056007272962959794, 5895514005284775249,  4825857599917744482,
        2093519537988072834,  -4390907564722863586, 8598973384036716702,  -1889020672280261540, -8273635663381002611,
        -1941314642980235766, 1812319066748738475,  4190176042918780749,  -4555199367311683530, 5467393609117797644,
        8359783806563259266,  3800668915803924955,  -2655932873935461949, 3136675805239089308,  -3633713411557631382,
        -672757299114219972,  3045962201700775993,  -3026485644327632861, -3372272670687649520, 3387661134442604201,
        3677140703283269642,  4482422720713908644,  1337692977628619063,  6948420747960198793,  -2492903114419653680,
        -5938903035079054289, -7806446185001452553, 9040686595201532492,  -2127381394247868345, 8655785215940696615,
        6435851473422996010,  -8509497626685383427, 1304836616586909040,  -2675436555158709746, 7454381249933066408,
        1631169664587044350,  6013206163109033855,  -2269271257167747155, 362749191994199052,   -2710425314932035541,
        -3130715904393787670, -4410494504975660198, 4957729582609338569,  -8246870151259110017, 6845983371242614475,
        -2258617392930568184, -8252230642158077029, 2670510062513563636,  -6653455225739816423, 3093107250382849352,
        1150551445512420048,  1546949923942708166,  5021898317351658427,  3707867854662121111,  -1206055501856481918,
        -1873593186785558123, 6775838224715797812,  -1115046710372778769, 528633723916988990,   -4174382295242439358,
        -5547557100483108777, 5731859982382023557,  2204054933203810496,  3007479017130878933,  6608694896063582073,
        1503694568421070630,  1248413523206321552,  -6401043893159800201, 1353202742204949340,  2304302719445899395,
        -1291964394378923514, -5522844881206564639, -1277367478728568636, 1849991021787670735,  478721890957105862,
        7757247149420834244,  -373709650675810738,  -5057614129950301004, 6162983513491054102,  3145006736835504836,
        5885317631158909353,  -7602326138257639761, -4157450027384868646, -1360567824864190920, 229176854089967110,
        -2202711857284656499, -2946750387084440631, -7399092435233174868, -931278862032913506,  8725183201793225879,
        4422438402418122694,  7390489870132742668,  5253764508555093227,  1198113859723757987,  7260998365611273804,
        1540767319493735478,  -5799740479458549922, 1136167730386243597,  1413668892541509388,  -8362134679601352333,
        3664237052291625965,  -7059531260401496534, 244969021945500288,   7960640458120876383,  -2144041369569582147,
        -8542531942333624037, -6912033525905196529, 7309130333167087960,  -1428796488709117140, 7889412153530907816,
        -6519274351560620428, -7194011194445795971, -2253470711475766161, 2052913415378741465,  8349030699411536987,
        2962275883196204755,  -8896757719886490153, -3481651114681941922, 9178906373760388169,  -2393681984948405823,
        -4722899724188292419, 2219571189613806132,  -8736536710280581263, -6631663654879231430, 1213083601717174358,
        351791283162447724,   -2728467560827636562, 2174378918144416458,  748751282949822397,   4251372914295826830,
        -4967177568325109568, 3825916028954041329,  7303839053387841791,  8648996684183789510,  -6188350610717327471,
        -9016026939100696370, 8366545235017906362,  -4151061240351591634, -3308165752571595210, 5710967263762362072,
        -7116887066458274066, 6003026705335466483,  -2788076296930402698, -696935785960712847,  -3523035848103775545,
        -4808396779515182120, -4487243801299967856, -316555344628268867,  2148745648896444003,  -7908465185551702581,
        209478862744791304,   8329349262325078360,  2312897865550480622,  3534430375708664567,  -4313813383770928446,
        7798388933635693783,  423303070618897314,   -6223899204612392666, -7997497118304435999, 1761514773996835425,
        -8886871075540730292};
    EXPECT_RRARRAY_EQ(AttachRRArray(i64_2b, 166, false), r->get_i64_2());

    // uint64
    EXPECT_NO_THROW(r->set_u64_1(1465640522145789825u));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_u64_1(), 13389861970863644378u));
    uint64_t u64_1a[] = {6515978873578326855u,  1465640522145789825u,  14139647178981527348u, 17376225719361197745u,
                         4827355217349405315u,  5237172857588412536u,  11185863429255124449u, 11922950710462888186u,
                         9723873762901963012u,  2360891509504070464u,  17595800616336901155u, 4676383109049523121u,
                         5519403084078587651u,  15199794964642249670u, 10725748072798711186u, 11861452006494413908u,
                         10866242934922922899u, 15599520359228044898u, 4022505103249338009u,  15081262745932646374u,
                         9978655822822015426u,  1893338345735521355u,  8335612627840221039u,  13125076221780371251u,
                         1843608744939432450u,  1877855184169582147u,  360237399108374165u,   14133486497511175136u,
                         6918428392028668980u,  4207262405010786686u,  11882372330517522341u, 2660307236802524516u,
                         16105897257753062921u, 2353931053072926625u,  10173424970756197713u, 3742480367255311168u,
                         1303431584704287527u,  12527899890265500372u, 32220987555692133u,    17556513786877588779u,
                         14599571048880016586u, 2017220613051019209u,  13580232873699969747u, 3864855431338072766u,
                         10522968089599101769u, 445176367690966897u,   7790111520686478868u,  6394442284921113988u,
                         16995884223523288612u, 11216569412804039035u, 4321418227933556664u,  5409834497962741327u,
                         690550291029646943u,   16074599988808644612u, 11236550486638087434u, 6844569081007881849u,
                         5869987636307743707u,  7778211196101597376u,  15853871901637280370u, 18058575643888946512u,
                         14027203060397441285u, 12712062502708340258u, 4041613882264720796u,  11645048579559315688u,
                         1246226537584125354u,  3474795601576826029u,  11513896830487717539u, 1974322205737539934u,
                         17242471345616954213u, 8678121572397745114u,  17527671945381764646u, 5033231148296076497u,
                         6411880965725185093u,  174473638020748044u,   8158678930583416018u,  9507609436552652251u,
                         16205993571484058929u, 8035338227846555833u,  8791374446603527925u,  14595445946451526244u,
                         5169961786923105799u,  13397974474224235898u, 2364042737119390982u,  5321299597050057517u,
                         1121024914655468441u,  12207167839097364776u, 12619831538472755181u, 4864354177058320218u,
                         17848460798228747459u, 13261044407690283599u, 10209900008497671979u, 6862409070349488681u,
                         1432310611369939292u,  2092522766869471913u,  15058223303172327711u, 4178174561433201628u,
                         12906394038648389198u, 15191542062580018441u, 16452252929507747318u, 11201120125455394600u,
                         6726163449083399053u,  8426476024479275017u,  7026246701397961488u,  9033438331677737541u,
                         5951673483825817230u,  10638919135849238472u, 3252342350133602871u,  15766880131631627052u,
                         12385842632184481382u, 2748643971592610065u,  6396730451340699978u,  13659499533346384982u,
                         4282043305472384300u,  1711405441567413160u,  17992713571449412921u, 3556627233283536994u,
                         4138074248161109398u,  1622144212241737621u,  18087263875532968938u, 14104137172003718411u,
                         7644309790031389842u,  8816844725250613052u,  11421439960737023984u, 10454322951672789795u,
                         2119200398037807197u,  8384409476347314289u,  2527068029837223073u,  4862875043870995989u,
                         17581079332542377528u, 18385625565005546141u, 5262116103886681622u,  14174635193688816521u,
                         3985859099523137999u,  5526499814203466410u,  1239704066545123753u,  5917443538249299253u,
                         878138865084935513u,   10218107935864045533u, 6547939038367120283u,  7353731416371741667u,
                         5504609912290331194u,  17697030959073472945u, 3134771705926671223u,  1308908721146697947u,
                         10579235124105673010u, 17332984836700322102u, 13722665407351335633u, 18423215754649979094u,
                         3171161736406578023u,  4234709098044006158u,  7347564326123203638u,  8195365762234651673u,
                         7781698260938130820u,  1180819293191049424u,  493531138123366511u,   1365828412106184272u,
                         10313217779396245974u, 7602972172978537794u,  6065626025778962290u,  9672897350080504270u};
    EXPECT_NO_THROW(r->set_u64_2(AttachRRArray(u64_1a, 160, false)));
    uint64_t u64_1b[] = {17812699909525330179u, 13389861970863644378u, 16257896157253761478u, 14191477546208115816u,
                         1387441194387183523u,  8800889055657239662u,  3787113061722336589u,  2075067786453142295u,
                         2302772129471114307u,  16660993589300385169u, 5227667125318999851u,  17211198982499914739u,
                         13967365476154884537u, 6210802835678950626u,  413837793611927178u,   15016088479821729126u,
                         14194309003275915218u, 5521545037113246785u,  9721585675207248367u,  2487154057124779480u,
                         4054392452442988950u,  15742440468026600431u, 8404041348136789525u,  5704587169648799325u,
                         8615894037736189999u,  7555294940121326684u,  166204857340424907u,   10630415758080788319u,
                         3699593146963368456u,  15841753586674104403u, 1425904355269403798u,  6757749835782369274u,
                         6484708862168533651u,  14311810156028177789u, 13305336491678304892u, 9547219694933920657u,
                         16939089102075290494u, 13780222831094724753u, 729578726262763066u,   6741605646549400625u,
                         860499368566843233u,   4821657628681234936u,  10629375059978179469u, 12676697982045410789u,
                         7965873501849669898u,  6463814633396676710u,  10304605129170106831u, 17634109250944839532u,
                         7874201956261190767u,  2093432098376142516u,  15162293521637815459u, 14480915389905814968u,
                         12246183009228206627u, 9927056522845945393u,  10708714764412026102u, 12620101894595011829u,
                         9720992984909508434u,  1335165052342958298u,  3842118717279685369u,  5703296853718993513u,
                         10169884007081888934u, 2514628960699067131u,  5254570865582417565u,  9562135776312844762u,
                         27891557900731192u,    14886705471885923481u, 3399688988254798568u,  14640082747632735324u,
                         12221809011211673821u, 12865683977160344326u, 12797396568995658538u, 16277433856161229511u,
                         5834216036130347946u,  41836075316600799u,    6171722505441450511u,  8601242920007887523u,
                         13624814788188880079u, 7848598808818978240u,  14273686016064474182u, 9616131192223535887u,
                         17907341921682029586u, 10138262866472100954u, 14661185914352643699u, 18102813560908894003u,
                         12307841218657619289u, 14709882437025014177u, 10238864911411793767u, 4776457610936466600u,
                         8782354639535937976u,  18274481696525890320u, 13992637006136445380u, 11566349649437476293u,
                         1209664843394078754u,  14394522101288007152u, 2915009092315033094u,  182528511086129450u,
                         15695741318843217573u, 744918667092745933u,   7146826536782008676u,  13838640680680387773u,
                         6708462726963541522u,  7741352156378706754u,  15062394166759350529u, 10613549923461193838u,
                         11002287295489384645u, 11112868002985992483u, 14972199425906445655u, 15176061787056984512u,
                         3369667758791907709u,  10545737311162535909u, 10549452773932875360u, 977025607559254534u,
                         8213649184128301518u,  16026014660753415782u, 16346803042848708719u, 8641570190583236526u,
                         10372374375551503871u, 8475065376071450531u,  9492316019190861724u,  7258336917778003543u,
                         7704933404615957344u,  14492234026024540236u};
    EXPECT_RRARRAY_EQ(AttachRRArray(u64_1b, 122, false), r->get_u64_2());

    // string
    EXPECT_NO_THROW(r->set_str1("Hello Server!"));
    EXPECT_NO_THROW(EXPECT_EQ(r->get_str1(), "Hello Client!"));

    // Read in and check the large structure struct1
    RR_INTRUSIVE_PTR<teststruct1> s1 = r->get_struct1();
    double s1_dat1a[] = {
        2.416507e+16,  4.573981e-21,  3.468194e+10,  -2.393703e-06, 4.937973e-15,  4.706768e+14,  4.286830e-10,
        -1.090462e-14, 2.238670e+03,  -1.254407e+14, -1.275776e-21, -4.124599e-10, -4.953108e+11, 2.808033e+03,
        4.685151e+14,  3.710607e-08,  3.523588e-01,  -5.585682e-20, -3.290719e+08, 1.600972e+17,  4.257210e+16,
        1.114490e+04,  2.739939e-10,  -4.332717e+16, 3.482223e+00,  -2.162451e+10, -4.527774e-04, 8.558987e-19,
        3.755463e-12,  3.863392e-08,  -8.351348e-05, 4.774283e+02,  -4.612524e-06, 2.206343e-06,  -2.767520e-17,
        -4.183387e+08, -2.037466e-19, -1.780912e-18, 1.656909e-07,  4.799751e+07,  -3.604348e-06, -3.146762e+08,
        -3.709450e+15, -2.379431e-09, -3.034066e+05, -3.072796e+01, -1.057111e-14, 4.753235e+07,  -2.725014e+07,
        -4.895406e-20, 5.339502e-20,  9.375211e-11,  1.632454e-03,  1.051386e+01,  1.915580e+17,  -1.999453e-09,
        -3.087190e-02, -3.222377e+15, 4.219576e+03,  -1.401039e+05, 3.950473e-15,  -1.620577e+10};
    EXPECT_RRARRAY_EQ(s1->dat1, AttachRRArray(s1_dat1a, 62, false));
    EXPECT_NO_THROW(EXPECT_EQ(s1->str2, "Hello world!"));
    EXPECT_NO_THROW(EXPECT_EQ(s1->vec3->size(), 3));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToString(s1->vec3->at(1)), "Hello Client!"));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToString(s1->vec3->at(2)), "Hello Client, again"));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToString(s1->vec3->at(4372)), "This is yet another test string"));

    double s1_s1_mydat[] = {-2.457273e-05, -3.349504e-13, 4.139542e-09,  -3.944556e+04, 2.761296e+04,  8.570027e+16,
                            -2.472613e-03, -2.096009e+03, -4.186716e+10, 4.584716e-20,  3.951344e-03,  4.557915e+05,
                            -7.117988e+03, -4.605957e+11, 7.353630e-10,  -3.303575e-19, 6.133982e+05,  4.528668e+01,
                            -1.427778e-11, -3.509465e+15, 1.695706e-04,  1.732872e+14,  -6.370107e+01, 3.269065e-06,
                            4.480613e+03,  2.058970e-06,  -3.748223e+05, -1.507989e-09, 1.690251e+19,  -2.177567e-08,
                            -2.391641e+16, 3.617128e+03,  2.568296e+15,  -3.009031e-07, -3.754976e-09, 2.458890e-06,
                            -3.800108e-11, 1.555663e-11,  -2.085887e+18, 8.574830e-22,  -7.228491e-13, -3.987643e-10,
                            -4.777544e-02, 3.908200e+04,  4.221779e+11,  -7.528852e+06, -2.077042e-19, 4.478813e-02,
                            3.506975e-06,  1.011231e+12,  -2.181961e+17, -5.098346e+16, -3.791130e+06, -2.734203e-14,
                            6.340994e-13,  -4.582535e+07, 3.977645e-06,  -3.785260e-07, -4.102542e+06, 4.751411e-16,
                            4.203566e-14,  -3.894958e+00, -4.585783e-14, 2.432993e+15,  -3.592680e+14, -1.560186e-12};
    EXPECT_RRARRAY_EQ(s1->struct1->mydat, AttachRRArray(s1_s1_mydat, 66, false));
    EXPECT_NO_THROW(EXPECT_EQ(s1->dstruct2->size(), 2));
    double s1_d1a[] = {3.785355e-17,  -2.518001e+17, 4.016500e+08,  6.566648e-04,  1.284318e+07,  -2.674821e-13,
                       -4.955749e-14, -1.699098e+00, 2.901400e+05,  1.499143e+13,  -2.252822e-05, -2.653172e-14,
                       -2.482811e+07, 2.353638e+18,  -2.177258e+17, -4.715112e+06, 4.508858e-18,  1.205611e+17,
                       -3.469181e+00, 2.383792e-13,  4.544766e+14,  -3.029250e-05, -2.545049e+05, 3.149303e+19,
                       -3.724982e-10, 4.066723e-02,  2.809941e-08,  1.279689e-20,  -3.303471e-09, 1.846558e+08,
                       1.311495e-06,  -1.185646e+04, -2.603100e-19, -3.519314e-17, -1.595996e+04, 9.735534e-20,
                       1.234003e-04,  -9.697458e+08, -4.895883e-02, 4.770089e-16,  3.757918e-11,  5.253446e+18,
                       5.071614e-13,  3.793300e-08,  -1.993536e+12, -1.846007e-11, -3.458666e+03, -3.995887e-10};
    EXPECT_RRARRAY_EQ(s1->dstruct2->at("test1")->mydat, AttachRRArray(s1_d1a, 48, false));
    double s1_d1b[] = {4.856615e+15,  5.981566e-22, 1.433616e+14,  1.747102e-09, 2.850376e+06,  -3.748685e-08,
                       -4.969544e-21, 2.530419e-01, 4.393913e-09,  3.837331e+04, -4.315065e-04, -1.073834e-17,
                       1.244057e-15,  3.901853e-10, -2.725237e+10, 2.896243e-18, 3.609897e-13,  -1.937982e+02};
    EXPECT_RRARRAY_EQ(s1->dstruct2->at("anothertest")->mydat, AttachRRArray(s1_d1b, 18, false));

    uint32_t s1_mul_a[] = {10, 10};
    double s1_mul_b[] = {
        -3.949071e-09, 2.753555e+10,  -2.724923e+07, -3.553170e+09, -3.674923e+08, -2.479267e-22, -4.898990e+18,
        -3.561455e+19, 3.890325e+13,  -4.980286e+18, 1.142884e-15,  1.570587e-12,  1.398743e-14,  1.769117e+11,
        2.086717e+05,  2.986916e+13,  -1.204547e-17, -6.138080e-08, -1.468512e-12, 3.240537e+11,  7.476873e+15,
        1.627340e+19,  -2.421611e-13, 3.549785e-20,  1.469061e+05,  4.172556e-06,  -3.369810e-17, -4.639587e+10,
        3.776574e-13,  4.990526e-08,  -1.321627e+07, 4.224942e+10,  -4.515185e-03, 3.619167e-12,  3.046092e+19,
        3.712879e+03,  -4.019784e-13, 4.005048e+18,  2.988709e-07,  -4.123078e-06, -1.064380e+09, -1.931617e-18,
        4.223366e-22,  1.783661e-19,  -4.153799e+16, 1.591527e-10,  -3.649908e-15, 4.348772e+18,  -1.470750e-14,
        1.637311e+08,  3.982951e-05,  -1.304963e-04, -3.522058e-06, 3.869385e+02,  -4.640831e-15, 1.292954e+00,
        -9.474137e+13, -4.196137e-17, -1.540996e+02, -1.742881e+00, -1.597433e-02, 4.062517e-04,  -2.724799e-13,
        -4.113398e+05, -4.704501e+02, 2.977726e+04,  -2.662004e+14, -1.376497e+04, -5.993109e-22, -1.265974e-15,
        6.387767e+11,  -2.696841e+04, -1.983347e+11, 3.214742e-13,  1.906709e-06,  -6.956937e+12, 3.637926e-07,
        2.706666e-16,  -9.795675e-19, 7.311871e-15,  2.343927e-09,  1.709674e+18,  2.961079e-05,  4.009574e+11,
        6.468308e-18,  -4.041410e+11, 2.991768e-15,  4.240906e+19,  2.260404e-12,  4.786043e-03,  2.439493e-09,
        1.698043e-13,  8.655885e-18,  -2.598418e-15, 6.685593e+05,  2.895287e+13,  -3.098095e-05, -3.764497e-06,
        3.192785e-12,  2.098857e-08};
    EXPECT_RRARRAY_EQ(s1->multidimarray->Dims, AttachRRArray(s1_mul_a, 2, false));
    EXPECT_RRARRAY_EQ(s1->multidimarray->Array, AttachRRArray(s1_mul_b, 100, false));

    // Set large structure for struct1
    RR_INTRUSIVE_PTR<teststruct1> s2(new teststruct1());
    double dat1a[] = {
        1.139065e-13,  -1.909737e+06, 2.922498e+18,  -1.566896e+15, 3.962168e+17,  -3.165123e+17, -1.136212e+13,
        3.041245e+16,  -4.181809e-18, 3.605211e-18,  -3.326815e-15, -4.686443e+05, -1.412792e+02, -3.823811e-14,
        -6.378268e-09, 1.260742e-14,  -2.136740e-16, -4.074535e-10, 2.218924e+01,  -3.400058e-08, 2.272064e+02,
        -2.982901e-21, 4.939616e-19,  -4.745500e+03, -1.985464e+16, 3.374194e-04,  -8.740159e-09, 1.470782e-06,
        -2.053287e+06, 4.007725e-13,  -1.598806e-13, 2.693773e-06,  -3.538743e-08, 4.854976e-16,  -4.778583e-12,
        3.069631e+06,  -3.749499e+03, 3.995802e+05,  -2.864014e+13, 1.276877e-13,  -4.479297e-02, -9.546403e-13,
        8.708525e+06,  3.800176e+04,  4.147260e+10,  2.252187e-20,  9.565646e-14,  4.177809e+13,  3.032250e+01,
        3.508303e+10,  -4.579380e-17, 1.128779e+05,  -1.064335e+11, 1.795376e-06,  -1.903884e+09, 2.699039e-03,
        3.658452e+15,  4.534803e+15,  1.366079e-03,  -3.557323e+07, -4.920382e+18, -3.358988e-07, -4.024967e-11,
        -4.784915e+16, 1.490340e-18,  -4.343678e+08, -1.955643e+14};
    s2->dat1 = AttachRRArray(dat1a, 67, false);
    s2->str2 = "Hello world 2!";
    RR_INTRUSIVE_PTR<RRMap<int32_t, RRArray<char> > > s2_3 = AllocateEmptyRRMap<int32_t, RRArray<char> >();
    s2_3->insert(make_pair(10, stringToRRArray("Hello Server!")));
    s2_3->insert(make_pair(11, stringToRRArray("Hello Server, again")));
    s2_3->insert(make_pair(46372, stringToRRArray("Test string!")));
    s2_3->insert(make_pair(46373, stringToRRArray("Test string again")));
    s2->vec3 = s2_3;

    RR_INTRUSIVE_PTR<RRMap<string, RRArray<char> > > s2_4 = AllocateEmptyRRMap<string, RRArray<char> >();
    s2_4->insert(make_pair("cteststring1", stringToRRArray("Hello Server!")));
    s2_4->insert(make_pair("cteststring2", stringToRRArray("Hello Server, again")));
    s2->dict4 = s2_4;

    RR_INTRUSIVE_PTR<RRList<RRArray<char> > > s2_5 = AllocateEmptyRRList<RRArray<char> >();
    s2_5->push_back(stringToRRArray("Hello Server!"));
    s2_5->push_back(stringToRRArray("Hello Server, again"));
    s2->list5 = s2_5;

    s2->struct1 = new teststruct2();
    double s2_struct1_mydat[] = {
        1.783093e+12,  -2.874045e-19, -2.311319e-19, -3.099234e-12, 1.000951e+16,  3.775247e-12,  -5.853550e-18,
        3.175537e-10,  -3.112089e+08, -1.577799e-06, -1.379590e+00, 4.777044e+13,  4.811910e+18,  4.736088e-11,
        1.770572e-08,  2.713978e-22,  -1.649841e-12, -2.486590e+10, 4.092716e-18,  8.724120e-03,  -1.183435e+18,
        -3.904438e+08, -1.251365e-11, -4.007750e+19, -2.206836e-16, 4.014728e-13,  -3.960975e-12, 7.192824e+05,
        1.981836e+04,  1.840814e+16,  1.488579e-16,  -4.862226e-06, 1.612923e-17,  -4.978203e-04, -2.305889e-02,
        7.627221e+13,  4.014563e-03,  2.388221e-03,  -1.129986e-02, 4.055276e+10,  3.842121e-10,  -8.588514e-04,
        1.299077e-12,  -3.331850e-12, 4.863277e-01,  -2.250328e-11, -2.261245e+04, -2.770899e+09, -4.710672e-15,
        -2.267765e+06, 1.582168e-09,  3.664505e-06,  -1.507921e+12, 5.460120e+09,  -3.256706e-15, 3.012178e-12,
        2.274894e+15,  -9.664342e-18, -2.770443e-15, -1.955281e-06, 4.768349e+01,  -7.679375e-19, 2.774544e-17,
        -4.928044e-17, 7.602063e-15,  2.506718e-12,  -2.794058e+11, 4.329292e+03,  -4.041289e-02, 4.035282e-19,
        8.577361e-04,  4.197333e-18,  -3.509270e-01, -1.711871e-12, 4.578825e-02,  -8.783497e-13, 3.862885e+17,
        4.219735e+13,  4.281035e-21,  3.323068e-03,  4.931847e-11,  4.032955e-21,  -4.373013e-03, 1.592633e-16,
        -4.484112e-16};
    s2->struct1->mydat = AttachRRArray(s2_struct1_mydat, 85, false);

    RR_INTRUSIVE_PTR<RRMap<string, teststruct2> > s2_ds2 = AllocateEmptyRRMap<string, teststruct2>();
    RR_INTRUSIVE_PTR<teststruct2> s2_ds2_1(new teststruct2());
    double s2_ds2_1a[] = {4.122753e+13,  -2.656829e-13, 1.813864e-04,  -4.675181e-05, 1.759511e-19,  3.517805e+10,
                          -7.912215e+01, 7.708557e-07,  2.434017e-21,  -2.540544e+00, -9.412568e+15, -2.124215e-18,
                          2.797799e+13,  -2.240464e-07, 2.780110e-12,  -1.025574e-14, -3.762272e-09, -5.715981e-02,
                          1.839704e-21,  -4.719538e-15, 3.148156e-06,  3.483886e-12,  3.484006e-02,  -4.544817e-08,
                          3.200642e+00,  4.503141e+07,  -4.077123e+04, -2.776985e+00, -2.900651e-18, -1.463711e+08,
                          -3.460292e-03, 2.348911e-18,  -3.704219e+08, -3.275364e+05, 4.613595e-01,  4.867108e+16,
                          4.114866e-10,  3.070767e+17,  4.662623e+01};
    s2_ds2_1->mydat = AttachRRArray(s2_ds2_1a, 39, false);
    s2_ds2->insert(make_pair("ctest1", s2_ds2_1));
    RR_INTRUSIVE_PTR<teststruct2> s2_ds2_2(new teststruct2());
    double s2_ds2_2a[] = {-1.037656e+15, -3.782364e-06, 4.982303e+06,  -5.510401e-07, 4.271118e-02,  -1.718093e+11,
                          -2.644457e+01, -2.374043e-08, 1.729038e-14,  3.370840e+10,  4.302550e-13,  2.643402e+14,
                          3.199649e+01,  4.620204e-08,  1.323645e+00,  -4.337167e-07, -5.003428e+11, 4.176127e+13,
                          3.324907e-09,  -4.207938e-09, -3.324360e-15, 3.317889e+00,  1.775668e+07,  -1.295276e-15,
                          -1.610388e-05, 3.417067e-02,  -4.874588e+04, -2.109628e+12, 3.130648e+09,  1.898554e-13,
                          2.421724e-01,  4.227281e-08,  4.844407e+19,  -4.490481e+10, 2.599780e+00,  4.039296e+06,
                          -2.944167e-03, -7.388370e+08, -4.473409e-02};
    s2_ds2_2->mydat = AttachRRArray(s2_ds2_2a, 39, false);
    s2_ds2->insert(make_pair("anothertest", s2_ds2_2));
    s2->dstruct2 = s2_ds2;

    RR_INTRUSIVE_PTR<RRList<teststruct2> > s2_ls3 = AllocateEmptyRRList<teststruct2>();
    RR_INTRUSIVE_PTR<teststruct2> s2_ls3_1(new teststruct2());
    // double s2_ls3_1a[]={ 4.122753e+13, -2.656829e-13, 1.813864e-04, -4.675181e-05, 1.759511e-19, 3.517805e+10,
    // -7.912215e+01, 7.708557e-07, 2.434017e-21, -2.540544e+00, -9.412568e+15, -2.124215e-18, 2.797799e+13,
    // -2.240464e-07, 2.780110e-12, -1.025574e-14, -3.762272e-09, -5.715981e-02, 1.839704e-21,
    // -4.719538e-15, 3.148156e-06, 3.483886e-12, 3.484006e-02, -4.544817e-08, 3.200642e+00, 4.503141e+07,
    // -4.077123e+04, -2.776985e+00, -2.900651e-18, -1.463711e+08, -3.460292e-03, 2.348911e-18, -3.704219e+08,
    // -3.275364e+05, 4.613595e-01, 4.867108e+16, 4.114866e-10, 3.070767e+17, 4.662623e+01 };
    s2_ls3_1->mydat = AttachRRArray(s2_ds2_1a, 39, false);
    s2_ls3->push_back(s2_ds2_1);
    RR_INTRUSIVE_PTR<teststruct2> s2_ls3_2(new teststruct2());
    double s2_ls3_2a[] = {-1.037656e+15, -3.782364e-06, 4.982303e+06,  -5.510401e-07, 4.271118e-02,  -1.718093e+11,
                          -2.644457e+01, -2.374043e-08, 1.729038e-14,  3.370840e+10,  4.302550e-13,  2.643402e+14,
                          3.199649e+01,  4.620204e-08,  1.323645e+00,  -4.337167e-07, -5.003428e+11, 4.176127e+13,
                          3.324907e-09,  -4.207938e-09, -3.324360e-15, 3.317889e+00,  1.775668e+07,  -1.295276e-15,
                          -1.610388e-05, 3.417067e-02,  -4.874588e+04, -2.109628e+12, 3.130648e+09,  1.898554e-13,
                          2.421724e-01,  4.227281e-08,  4.844407e+19,  -4.490481e+10, 2.599780e+00,  4.039296e+06,
                          -2.944167e-03, -7.388370e+08, -4.473409e-02};
    s2_ls3_2->mydat = AttachRRArray(s2_ls3_2a, 39, false);
    s2_ls3->push_back(s2_ds2_2);
    s2->lstruct3 = s2_ls3;

    uint32_t s2_mda[] = {10, 10};
    double s2_mdb[] = {
        2.430620e+07,  -3.455593e-03, 3.902400e+12,  -2.638755e-03, 3.850613e+07,  4.754008e-11,  4.661031e-06,
        -3.707214e-19, -7.073631e+02, 2.254953e-04,  -1.575093e-16, 5.197798e-13,  -9.801721e+03, -1.787872e+19,
        -3.366880e-19, -6.242096e-19, 4.750613e+12,  2.200462e-07,  2.175487e+10,  -4.574155e+13, -2.009829e-18,
        4.228100e-10,  -3.002835e-06, -4.486729e+06, 5.433280e-05,  -1.966891e-02, -3.934083e+11, 3.893263e-01,
        2.139116e-13,  2.223028e+19,  -9.567949e+17, -2.740272e+16, 1.099169e-03,  -1.569567e+07, 1.960769e-10,
        2.839805e-11,  -4.907690e-21, 2.112493e-18,  -4.618149e-10, 2.613307e+14,  2.590624e-17,  3.838474e+13,
        3.249062e-08,  -3.456972e-02, -5.653457e-19, -3.560782e-17, 4.205253e+10,  -1.775030e-11, -2.490865e+04,
        -2.059649e-07, 1.126958e+00,  1.236458e+16,  4.050441e+17,  3.706921e+11,  -5.893431e-13, -3.802021e-05,
        4.939106e-17,  -2.295579e+11, 2.784939e-18,  2.251843e+07,  4.187086e+13,  -8.627249e-13, -1.636854e-09,
        3.436699e+05,  -1.494004e-06, 1.669621e-05,  4.224858e-11,  -1.206711e-21, -4.717112e-12, 2.149234e+09,
        4.829485e-12,  -9.782035e-03, -4.809568e+11, -2.363817e-20, -1.774867e-19, 2.675132e-08,  -3.796278e+06,
        8.447614e-11,  -2.926861e+01, -3.179427e+19, -2.686571e+01, 4.629595e-21,  -4.785666e-19, 1.189135e+05,
        3.103998e-16,  9.759246e-06,  1.974804e-15,  -2.446973e-18, -2.116347e-10, 3.372892e+14,  3.756516e+18,
        1.818836e-01,  5.930870e+08,  -2.908608e+14, -4.900761e+01, -1.467246e+11, -2.431436e-08, -2.025905e-13,
        6.246066e+01,  1.601360e+13};
    s2->multidimarray =
        AllocateRRMultiDimArray<double>(AttachRRArray(s2_mda, 2, false), AttachRRArray(s2_mdb, 100, false));
    double s2_var3a[] = {6.404176e-12,  9.258110e-03,  8.657620e-03, -2.064381e+00, 5.182360e-16,
                         4.167658e-16,  -4.533051e-19, 5.357520e+18, -4.990383e-13, 2.286982e+08,
                         -4.727256e-18, 1.465299e-17,  3.000340e-10, -2.304453e-04};
    s2->var3 = AttachRRArray(s2_var3a, 14, false);

    EXPECT_NO_THROW(r->set_struct1(s2));

    // Test is_d1
    RR_INTRUSIVE_PTR<RRMap<int32_t, RRArray<double> > > is_d1_1 = r->get_is_d1();
    EXPECT_NO_THROW(EXPECT_EQ(is_d1_1->size(), 3));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(is_d1_1->at(9285)), 1.643392e-1));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(is_d1_1->at(74822)), 1.537133e+09));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(is_d1_1->at(4)), 1.369505e-03));

    RR_INTRUSIVE_PTR<RRMap<int32_t, RRArray<double> > > is_d1_2 = AllocateEmptyRRMap<int32_t, RRArray<double> >();
    is_d1_2->insert(make_pair(928, ScalarToRRArray(4.074501e-07)));
    is_d1_2->insert(make_pair(394820, ScalarToRRArray(-4.535303e+05)));
    is_d1_2->insert(make_pair(623, ScalarToRRArray(-2.956241e-20)));
    EXPECT_NO_THROW(r->set_is_d1(is_d1_2));

    // Test is_d2
    RR_INTRUSIVE_PTR<RRMap<string, RRArray<double> > > is_d2_1 = r->get_is_d2();
    EXPECT_NO_THROW(EXPECT_EQ(is_d2_1->size(), 2));
    EXPECT_DOUBLE_EQ(RRArrayToScalar(is_d2_1->at("testval1")), -1.079664e+16);
    EXPECT_DOUBLE_EQ(RRArrayToScalar(is_d2_1->at("testval2")), 2.224846e+00);

    RR_INTRUSIVE_PTR<RRMap<string, RRArray<double> > > is_d2_2 = AllocateEmptyRRMap<string, RRArray<double> >();
    is_d2_2->insert(make_pair("testval3", ScalarToRRArray(5.242474e+10)));
    is_d2_2->insert(make_pair("testval4", ScalarToRRArray(2.208636e+08)));
    EXPECT_NO_THROW(r->set_is_d2(is_d2_2));

    // Test is_d3

    double is_d3_1a[] = {8.609080e-13,  3.946603e+03,  2.994203e-10,  3.200877e+14,  1.747361e-09,
                         2.827056e-16,  -3.676613e-18, 1.886901e-14,  -9.970511e-12, 1.932468e-18,
                         -3.629253e-05, 4.903023e-12,  -3.919949e-10, 4.982164e+07,  3.823096e-20,
                         -4.044068e-13, 3.114078e+09,  7.572697e-12,  -2.619929e+04, -3.882046e+01};
    double is_d3_1b[] = {4.750899e+00, 3.924377e+18,  -2.735066e+17, 4.095362e-21,  -2.407932e+09,
                         4.059499e+10, 1.376975e-10,  -8.547220e-21, -1.344568e-20, 2.809398e+03,
                         2.118944e-06, 2.435328e-03,  -1.410999e-12, 9.907226e-04,  -9.745948e-20,
                         1.270118e+15, -2.833333e+05, 1.032636e-10,  5.312574e+13,  -2.651512e+02};

    RR_INTRUSIVE_PTR<RRMap<int32_t, RRArray<double> > > is_d3_1 = r->get_is_d3();
    EXPECT_EQ(is_d3_1->size(), 2);
    EXPECT_RRARRAY_EQ(is_d3_1->at(12), AttachRRArray(is_d3_1a, 20, false));
    EXPECT_RRARRAY_EQ(is_d3_1->at(832), AttachRRArray(is_d3_1b, 20, false));

    double is_d3_2a[] = {4.335907e-08,  -3.270294e-03, 1.752801e-01,  1.235219e-20,  -4.348647e+02,
                         -4.503864e-21, -3.316231e+15, -2.080056e+17, 1.813854e+13,  -3.380846e-05,
                         4.350998e+03,  4.539570e+11,  8.981827e+09,  3.326114e+01,  2.975688e+06,
                         -1.017456e-12, 2.989498e-03,  2.842392e-03,  -1.258677e-21, 1.068563e-15};
    double is_d3_2b[] = {3.239279e+12,  1.047689e+17,  -1.236114e+17, -4.002822e-17, 2.657374e-03,
                         7.383907e-19,  -5.067889e-13, -4.195122e-12, 3.642885e-01,  -2.946040e+14,
                         5.522403e-08,  6.603132e+04,  1.464154e+05,  -1.851534e-08, 2.808294e-13,
                         -2.702278e-11, 3.850704e-06,  -2.453957e+02, -3.015401e-02, 1.654070e+05};

    RR_INTRUSIVE_PTR<RRMap<int32_t, RRArray<double> > > is_d3_2 = AllocateEmptyRRMap<int32_t, RRArray<double> >();
    is_d3_2->insert(make_pair(47, AttachRRArray(is_d3_2a, 20, false)));
    is_d3_2->insert(make_pair(324, AttachRRArray(is_d3_2b, 20, false)));
    EXPECT_NO_THROW(r->set_is_d3(is_d3_2));

    // Test is_d4

    double is_d4_1a[] = {1.113851e-04,  3.830104e+07, 4.571169e-21,  -4.064180e-05, 2.889736e+01,
                         -1.790060e-06, 4.608538e+00, 4.687713e-04,  1.387717e-08,  3.914187e-18,
                         -5.618118e-06, 1.530811e+05, -5.848922e-11, -3.397558e-20, -6.597368e-08,
                         -3.779049e-06, 2.406033e-19, 2.507939e-10,  3.246113e-20,  1.341205e+16};
    double is_d4_1b[] = {-3.088190e-13, -4.033334e-20, 4.150103e-21,  -6.610855e+17, 3.688824e-13,
                         -3.208025e+13, -5.034888e-11, -4.098363e-06, -1.272830e-03, 2.748392e-03,
                         -2.644272e-06, -4.810065e-18, 4.629861e-19,  -5.444015e-03, 4.046008e+17,
                         -3.548079e+12, -3.455290e+16, -3.668946e-12, -3.522178e-01, -1.537583e+14};

    RR_INTRUSIVE_PTR<RRMap<string, RRArray<double> > > is_d4_1 = r->get_is_d4();
    EXPECT_NO_THROW(EXPECT_EQ(is_d4_1->size(), 2));
    EXPECT_RRARRAY_EQ(is_d4_1->at("testval1"), AttachRRArray(is_d4_1a, 20, false));
    EXPECT_RRARRAY_EQ(is_d4_1->at("testval2"), AttachRRArray(is_d4_1b, 20, false));

    double is_d4_2a[] = {1.771838e+06, 3.037284e-01,  -1.739742e-02, 1.399508e-20,  3.605232e-21,
                         3.517522e+14, 4.887514e+14,  3.505442e-03,  -3.968972e+18, 1.422037e-20,
                         2.596937e-21, 4.852833e-11,  6.852955e-17,  4.765526e-12,  -3.445954e+16,
                         2.322531e-14, -1.755122e-12, 3.941875e+00,  8.877046e-13,  2.818923e-02};
    double is_d4_2b[] = {4.146439e+16,  2.923439e-07,  3.549608e+16,  -1.664891e-01, -4.192309e-15,
                         3.857317e+05,  -1.101076e+00, 1.213105e+19,  3.237584e-14,  -2.421219e-06,
                         -4.603196e-05, -3.719535e-10, 1.124961e+06,  2.032849e+10,  4.639704e-22,
                         3.946835e+01,  -9.267263e+01, -4.456188e+11, 3.470487e+08,  7.918764e+10};

    RR_INTRUSIVE_PTR<RRMap<string, RRArray<double> > > is_d4_2 = AllocateEmptyRRMap<string, RRArray<double> >();
    is_d4_2->insert(make_pair("testval3", AttachRRArray(is_d4_2a, 20, false)));
    is_d4_2->insert(make_pair("testval4", AttachRRArray(is_d4_2b, 20, false)));
    EXPECT_NO_THROW(r->set_is_d4(is_d4_2));

    // Test is_d5
    RR_INTRUSIVE_PTR<RRMap<int, RRMultiDimArray<double> > > is_d5_1 = r->get_is_d5();
    EXPECT_NO_THROW(EXPECT_EQ(is_d5_1->size(), 1));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > is_d5_1_1 = is_d5_1->at(564);
    uint32_t is_d5_1_1a[] = {10, 10};
    EXPECT_RRARRAY_EQ(is_d5_1_1->Dims, AttachRRArray(is_d5_1_1a, 2, false));
    double is_d5_1_1b[] = {
        -2.240130e+14, 1.609980e+16,  -1.794755e+07, 8.108785e+17,  -2.296286e+08, -2.689029e+13, 2.036672e+07,
        -4.822871e-02, 4.070748e-05,  -2.894952e-04, -1.728526e+17, 4.077694e-19,  -2.977734e+13, -9.428667e+03,
        2.672315e-08,  -1.844359e+19, 4.243010e+09,  4.592716e-01,  -3.792531e+10, 3.117892e+04,  -1.830821e-16,
        -3.702984e-18, -1.957300e+12, 9.017553e+12,  -2.184986e-17, 1.436890e-02,  4.008279e-12,  -2.407568e+10,
        -3.170667e-07, -2.315539e+16, 6.646599e+09,  2.443847e-01,  1.928730e-21,  3.089540e+00,  2.813232e-02,
        1.352336e-21,  -3.562256e+05, 3.778036e+08,  -3.726478e-13, 3.112159e+15,  3.573414e+17,  3.607559e+09,
        -2.923247e-19, -2.079346e+14, -4.611547e-16, 2.200040e+00,  3.670772e+07,  -4.176987e-20, 2.086575e+06,
        -2.388241e+01, -3.759717e-19, -2.232760e-01, 9.066157e-21,  2.797633e+07,  3.455296e+00,  -3.306761e-08,
        -2.062866e-22, -4.653724e+07, -3.694312e-17, 2.254095e-06,  3.519767e-16,  1.292737e-06,  -3.840896e-08,
        -1.946825e-20, 2.639141e+18,  3.021503e+07,  -1.834066e+18, 4.474920e-02,  3.005033e-20,  -1.233782e-10,
        -3.260111e-08, 2.326419e-09,  -2.298222e-19, 7.554873e+15,  2.378479e+19,  -5.092127e-03, -4.724838e-07,
        3.204184e+06,  2.713748e-12,  1.574309e-05,  6.622323e-01,  -4.944461e-01, -1.559672e+19, -3.350494e+15,
        2.467451e-14,  -4.881873e+13, 1.031263e+15,  -4.051814e+12, 1.418548e+07,  1.204368e+17,  -4.113152e-02,
        -4.472069e+16, 4.896886e-14,  2.371633e+05,  3.543019e+04,  -3.083516e-22, 1.041761e-09,  -2.579812e-06,
        -2.937567e+09, -4.775349e-16};
    EXPECT_RRARRAY_EQ(is_d5_1_1->Array, AttachRRArray(is_d5_1_1b, 100, false));

    uint32_t is_d5_2_1a[] = {10, 20};
    double is_d5_2_1b[] = {
        2.792909e-01,  6.554477e+16,  4.240073e-13,  -4.490109e+19, 5.410527e-22,  -2.244599e+17, -2.656142e-02,
        -3.819500e+13, -7.086082e-02, 7.790729e-13,  3.375900e-12,  -6.915692e+09, -2.900437e-18, 1.257280e+05,
        -3.810852e+15, -4.589554e-12, 2.670612e-14,  4.725686e+06,  -3.018046e+07, 2.439452e+07,  2.726039e-07,
        -2.805143e+02, -1.870376e+03, 4.573047e-06,  1.904868e+19,  -1.966383e+00, 3.426469e-11,  -1.400396e+13,
        -1.724273e+09, -7.347198e+10, -4.081057e-12, -3.868203e+10, -2.686071e+13, -5.289107e+01, -5.574151e-09,
        -2.580185e-06, -8.222097e-21, -4.957833e-12, -2.491984e+03, -7.900042e+16, -4.809370e-11, -2.048332e-19,
        4.984852e-21,  1.350023e+13,  -4.492022e-11, -3.255594e+10, 1.495149e-09,  -7.272628e+02, -4.236196e-04,
        4.736990e-02,  -4.030173e-11, 1.017371e+11,  1.124559e-09,  4.177431e-21,  1.026706e+06,  -4.702729e-04,
        -2.633498e+18, -4.689724e+08, -2.593657e+05, 3.433194e-18,  -1.977738e-13, -1.163773e+03, 3.424738e-20,
        7.391132e-06,  1.364867e+12,  -7.155727e+16, 3.078093e-21,  -3.151787e-04, -4.715633e+06, 1.017894e+19,
        -1.121778e+14, -3.529769e-10, 4.530606e+19,  3.988296e-17,  -3.469818e+06, 1.204304e+03,  -1.404314e+15,
        -1.369871e+04, -2.796125e-03, -4.842068e-06, -2.639632e-03, 1.324740e+08,  1.440651e+07,  -4.778885e+03,
        -4.643859e+06, 1.726955e-09,  -8.160334e+05, 3.763238e+13,  1.391028e+02,  -4.269393e+04, -2.698233e+02,
        -3.677556e+14, 1.070699e-17,  3.949376e+19,  4.503080e-06,  4.344496e-07,  1.714091e-19,  -3.436426e+01,
        4.914505e+15,  -1.101617e+09, -1.899511e-04, 2.195951e-06,  2.402701e-12,  1.783431e-09,  -7.329137e-08,
        4.423889e+16,  2.812547e-19,  -7.848554e+05, -3.635151e+13, 3.128605e-09,  -2.858963e+08, 2.086065e-11,
        -2.544450e+12, 1.450579e+19,  -1.508905e+13, 4.307174e+00,  1.038108e-05,  4.313281e-05,  3.647351e+05,
        1.309105e-16,  4.180469e+13,  -2.701332e-07, -4.033566e+14, -3.116748e-06, 2.342296e-07,  1.870335e-19,
        2.312273e+01,  -4.478923e+08, -4.854324e+09, 2.681828e+03,  -4.280128e-01, -4.690703e-21, 3.853815e+16,
        1.366639e+02,  -2.944985e-11, -4.486958e-13, 3.017750e-11,  3.551437e-13,  2.263828e-12,  -6.545014e-18,
        -7.552023e+12, 7.595238e+14,  2.810247e+12,  6.516008e+15,  -3.035786e+14, 2.523040e+11,  -3.766603e+09,
        7.316287e+18,  -2.147132e+17, 1.972210e+10,  2.906768e-13,  4.226577e-14,  -2.640568e+17, 2.181408e+10,
        -1.043256e-08, -3.649181e+06, -2.776638e+18, 3.660147e-07,  -1.415433e-17, -4.945127e-17, 2.655050e+01,
        -2.269828e+04, -2.585499e-01, -3.299965e+05, 3.707494e-18,  -1.257923e-19, -1.321880e+14, -1.815888e-12,
        9.366926e-09,  1.024923e-14,  4.494907e+04,  -2.596971e-20, -3.403446e-12, 1.537084e+17,  -3.850430e-17,
        -4.821759e+05, 4.255435e-20,  -1.016978e-16, 1.430658e-09,  -3.696861e-14, -4.427905e-19, -1.999724e-09,
        -3.489402e-06, -4.677864e-03, 1.246884e+13,  -4.458271e-19, 3.551905e-04,  -4.458221e-20, -3.472033e+01,
        -1.745714e+08, 4.396891e+03,  4.345767e+02,  -1.800116e+05, -1.217318e+00, 3.605072e-08,  1.306109e-09,
        -2.798295e+16, 4.387728e-13,  -3.284039e+11, 3.424124e+17};
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > is_d5_2_1 =
        AllocateRRMultiDimArray<double>(AttachRRArray(is_d5_2_1a, 2, false), AttachRRArray(is_d5_2_1b, 200, false));
    RR_INTRUSIVE_PTR<RRMap<int32_t, RRMultiDimArray<double> > > is_d5_2 =
        AllocateEmptyRRMap<int32_t, RRMultiDimArray<double> >();
    is_d5_2->insert(make_pair(328, is_d5_2_1));
    EXPECT_NO_THROW(r->set_is_d5(is_d5_2));

    // Test is_d6
    RR_INTRUSIVE_PTR<RRMap<string, RRMultiDimArray<double> > > is_d6_1 = r->get_is_d6();
    EXPECT_NO_THROW(EXPECT_EQ(is_d6_1->size(), 1));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > is_d6_1_1 = is_d6_1->at("testval1");
    uint32_t is_d6_1_1a[] = {5, 10};
    EXPECT_RRARRAY_EQ(is_d6_1_1->Dims, AttachRRArray(is_d6_1_1a, 2, false));
    double is_d6_1_1b[] = {4.229153e+02,  3.406523e+03,  -2.158208e+15, -7.464845e+07, -4.763504e+18, 6.777497e-20,
                           -1.265130e+18, 2.145141e+12,  -8.473642e-18, -3.780104e+17, -4.356069e+06, 1.199990e+04,
                           -2.413259e+07, -2.609077e-12, -2.121030e-16, -1.224176e+09, -2.836294e-15, -1.975701e-18,
                           4.311314e-04,  -4.932020e-20, -1.307735e-18, -4.000536e+02, -1.718325e+15, -3.493595e+05,
                           1.707089e+00,  4.416780e+01,  -1.152954e-13, 8.396437e-02,  -4.304750e+16, 1.154166e+02,
                           -2.331328e-02, 4.821737e-04,  5.831989e-20,  -6.887913e+06, -1.592772e+11, 4.730754e-19,
                           2.543760e-17,  -5.864767e+14, 2.077122e-13,  2.801695e-12,  -1.171678e+12, -8.854966e+18,
                           -1.555508e-08, 3.589410e+11,  -1.495443e-21, 2.876586e-06,  -2.265460e-03, 2.544109e-03,
                           2.019117e-06,  -6.458547e-21};
    EXPECT_RRARRAY_EQ(is_d6_1_1->Array, AttachRRArray(is_d6_1_1b, 50, false));

    uint32_t is_d6_2_1a[] = {8, 10};
    double is_d6_2_1b[] = {
        2.080438e+03,  -2.901444e-01, 2.561452e+12,  6.760682e+14,  -2.461568e-10, -4.811907e-20, 6.299564e+11,
        -2.660066e-19, 4.643316e+13,  3.292265e-13,  1.187460e+19,  3.054313e-07,  3.503026e-20,  -1.465147e-08,
        3.993039e-17,  2.469296e-10,  -4.014504e+07, 1.810733e+17,  -3.976509e-19, -9.166607e+15, 1.854678e+02,
        2.884879e-12,  -4.382521e+14, 3.064407e-05,  -9.542195e+07, -3.938411e-13, -2.850416e-03, 3.042038e+14,
        1.464437e-12,  -1.550126e-06, 4.938341e+11,  -3.517527e+19, 3.135793e+19,  1.380313e-14,  -1.060961e+18,
        2.833127e-10,  -1.862230e+02, -2.232851e-05, 4.773548e-05,  3.746071e+13,  -4.972451e+09, 4.553754e-14,
        -8.183438e+10, 3.739120e+18,  -1.619189e+19, 4.644394e+08,  -8.327578e-11, 4.080876e-02,  -2.806082e-03,
        -1.595033e-06, 1.973067e+16,  2.989575e-07,  -8.974247e+15, -4.204211e-03, 1.513025e-02,  -4.604953e+03,
        4.107290e+16,  -3.631920e+12, -1.902472e+13, -4.186326e-14, 2.465135e+13,  5.060414e+12,  7.508582e+11,
        3.233186e-14,  -6.750005e+14, -9.467336e-16, 2.101440e+03,  -1.162425e+08, 7.808216e+04,  4.356208e-19,
        -3.316834e+14, 3.299774e-19,  -3.746431e-16, -3.971172e-07, 2.423744e+10,  1.542747e+17,  2.358704e-05,
        4.201668e+17,  -3.736856e+07, 3.585645e-07};
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > is_d6_2_1 =
        AllocateRRMultiDimArray<double>(AttachRRArray(is_d6_2_1a, 2, false), AttachRRArray(is_d6_2_1b, 80, false));
    RR_INTRUSIVE_PTR<RRMap<string, RRMultiDimArray<double> > > is_d6_2 =
        AllocateEmptyRRMap<string, RRMultiDimArray<double> >();
    is_d6_2->insert(make_pair("testval2", is_d6_2_1));
    EXPECT_NO_THROW(r->set_is_d6(is_d6_2));

    // Test is_struct1
    RR_INTRUSIVE_PTR<RRMap<int32_t, teststruct2> > is_struct1_1 = r->get_is_struct1();
    double is_struct1_1a[] = {-9.692618e+00, -1.944240e+03, -2.456327e+16, 4.673405e-20,  5.147581e-14,
                              -3.773975e+15, 2.336430e-21,  1.597144e-18,  -2.609059e-03, 3.557639e-21,
                              -1.666575e-16, -4.242788e-07, 2.686206e+07,  -3.200902e-05, -1.549754e-06,
                              -3.010796e-12, 4.638418e+01,  2.664397e-14,  -2.689174e+01, 4.564584e-21};
    EXPECT_RRARRAY_EQ(is_struct1_1->at(748)->mydat, AttachRRArray(is_struct1_1a, 20, false));

    RR_INTRUSIVE_PTR<RRMap<int32_t, teststruct2> > is_struct1_2 = AllocateEmptyRRMap<int32_t, teststruct2>();
    RR_INTRUSIVE_PTR<teststruct2> is_struct1_2_1(new teststruct2());
    double is_struct1_2_1a[] = {-2.101948e-07, -2.594836e-08, 2.515710e+01,  -3.834127e-14, -3.088095e+06,
                                -3.256612e-02, -1.855481e-19, 3.801916e+07,  2.145894e+09,  4.487676e+12,
                                1.351202e-02,  -1.125124e-16, 1.369826e-20,  -2.290673e+00, 1.786029e-20,
                                -4.991515e+08, 4.006107e-10,  -4.947871e-11, -2.737020e-08, 4.123759e-20};
    is_struct1_2_1->mydat = AttachRRArray(is_struct1_2_1a, 20, false);
    is_struct1_2->insert(make_pair(372, is_struct1_2_1));
    EXPECT_NO_THROW(r->set_is_struct1(is_struct1_2));

    // Test is_struct2
    RR_INTRUSIVE_PTR<RRMap<string, teststruct2> > is_struct2_1 = r->get_is_struct2();
    double is_struct2_1a[] = {-4.489570e+13, 9.574895e-05,  4.081711e+06,  5.612839e-18,  -1.078604e+05,
                              3.658139e+08,  -4.748975e+05, -2.606481e+01, 3.016739e+15,  3.174709e+19,
                              -4.572549e+17, 1.980389e-04,  -3.551911e-10, 3.598401e-07,  2.659416e-12,
                              -3.606157e+06, 2.059674e+17,  -9.362336e-20, -3.299256e+17, -2.245745e+16};
    EXPECT_RRARRAY_EQ(is_struct2_1->at("testval1")->mydat, AttachRRArray(is_struct2_1a, 20, false));

    RR_INTRUSIVE_PTR<RRMap<string, teststruct2> > is_struct2_2 = AllocateEmptyRRMap<string, teststruct2>();
    RR_INTRUSIVE_PTR<teststruct2> is_struct2_2_1(new teststruct2());
    double is_struct2_2_1a[] = {6.931327e-21,  4.527137e-02,  1.260822e-18,  3.592805e-12,  1.088317e-05,
                                3.305865e+03,  -9.798828e-20, 1.497504e+18,  -3.653592e+01, 1.473952e+10,
                                -1.003612e-20, 1.302159e+18,  -8.544326e+05, 1.038521e+16,  -2.845746e-18,
                                -3.899909e-04, 4.785560e-02,  -7.203365e-12, -1.500022e-14, -1.892753e-17};
    is_struct2_2_1->mydat = AttachRRArray(is_struct2_2_1a, 20, false);
    is_struct2_2->insert(make_pair("testval2", is_struct2_2_1));
    EXPECT_NO_THROW(r->set_is_struct2(is_struct2_2));

    // Test list_d1

    RR_INTRUSIVE_PTR<RRList<RRArray<double> > > list_d1_1 = r->get_list_d1();
    EXPECT_NO_THROW(EXPECT_EQ(list_d1_1->size(), 3));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(list_d1_1->front()), 1.643392e-1));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(*(++list_d1_1->begin())), 1.537133e+09));
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToScalar(*(++(++list_d1_1->begin()))), 1.369505e-03));

    RR_INTRUSIVE_PTR<RRList<RRArray<double> > > list_d1_2 = AllocateEmptyRRList<RRArray<double> >();
    list_d1_2->push_back(ScalarToRRArray(4.074501e-07));
    list_d1_2->push_back(ScalarToRRArray(-4.535303e+05));
    list_d1_2->push_back(ScalarToRRArray(-2.956241e-20));
    EXPECT_NO_THROW(r->set_list_d1(list_d1_2));

    // Test list_d3

    // double list_d3_1a[]={8.609080e-13, 3.946603e+03, 2.994203e-10, 3.200877e+14, 1.747361e-09, 2.827056e-16,
    // -3.676613e-18, 1.886901e-14, -9.970511e-12, 1.932468e-18, -3.629253e-05, 4.903023e-12,
    // -3.919949e-10, 4.982164e+07, 3.823096e-20, -4.044068e-13, 3.114078e+09, 7.572697e-12, -2.619929e+04,
    // -3.882046e+01}; double list_d3_1b[]={ 4.750899e+00, 3.924377e+18, -2.735066e+17, 4.095362e-21,
    // -2.407932e+09, 4.059499e+10, 1.376975e-10, -8.547220e-21,
    // -1.344568e-20, 2.809398e+03, 2.118944e-06, 2.435328e-03, -1.410999e-12, 9.907226e-04,
    // -9.745948e-20, 1.270118e+15, -2.833333e+05, 1.032636e-10, 5.312574e+13, -2.651512e+02 };

    RR_INTRUSIVE_PTR<RRList<RRArray<double> > > list_d3_1 = r->get_list_d3();
    EXPECT_EQ(list_d3_1->size(), 2);
    EXPECT_RRARRAY_EQ(list_d3_1->front(), AttachRRArray(is_d3_1a, 20, false));
    EXPECT_RRARRAY_EQ(*(++list_d3_1->begin()), AttachRRArray(is_d3_1b, 20, false));

    // double list_d3_2a[]={ 4.335907e-08, -3.270294e-03, 1.752801e-01, 1.235219e-20, -4.348647e+02, -4.503864e-21,
    // -3.316231e+15, -2.080056e+17, 1.813854e+13,
    // -3.380846e-05, 4.350998e+03, 4.539570e+11, 8.981827e+09, 3.326114e+01, 2.975688e+06,
    // -1.017456e-12, 2.989498e-03, 2.842392e-03, -1.258677e-21, 1.068563e-15 }; double
    // list_d3_2b[]={ 3.239279e+12, 1.047689e+17, -1.236114e+17, -4.002822e-17, 2.657374e-03, 7.383907e-19,
    // -5.067889e-13, -4.195122e-12, 3.642885e-01, -2.946040e+14, 5.522403e-08, 6.603132e+04, 1.464154e+05,
    // -1.851534e-08, 2.808294e-13, -2.702278e-11, 3.850704e-06, -2.453957e+02, -3.015401e-02, 1.654070e+05 };

    RR_INTRUSIVE_PTR<RRList<RRArray<double> > > list_d3_2 = AllocateEmptyRRList<RRArray<double> >();
    list_d3_2->push_back(AttachRRArray(is_d3_2a, 20, false));
    list_d3_2->push_back(AttachRRArray(is_d3_2b, 20, false));
    EXPECT_NO_THROW(r->set_list_d3(list_d3_2));

    // Test list_d5

    RR_INTRUSIVE_PTR<RRList<RRMultiDimArray<double> > > list_d5_1 = r->get_list_d5();
    EXPECT_NO_THROW(EXPECT_EQ(list_d5_1->size(), 1));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > list_d5_1_1 = list_d5_1->front();
    uint32_t list_d5_1_1a[] = {10, 10};
    EXPECT_RRARRAY_EQ(list_d5_1_1->Dims, AttachRRArray(list_d5_1_1a, 2, false));
    double list_d5_1_1b[] = {
        -2.240130e+14, 1.609980e+16,  -1.794755e+07, 8.108785e+17,  -2.296286e+08, -2.689029e+13, 2.036672e+07,
        -4.822871e-02, 4.070748e-05,  -2.894952e-04, -1.728526e+17, 4.077694e-19,  -2.977734e+13, -9.428667e+03,
        2.672315e-08,  -1.844359e+19, 4.243010e+09,  4.592716e-01,  -3.792531e+10, 3.117892e+04,  -1.830821e-16,
        -3.702984e-18, -1.957300e+12, 9.017553e+12,  -2.184986e-17, 1.436890e-02,  4.008279e-12,  -2.407568e+10,
        -3.170667e-07, -2.315539e+16, 6.646599e+09,  2.443847e-01,  1.928730e-21,  3.089540e+00,  2.813232e-02,
        1.352336e-21,  -3.562256e+05, 3.778036e+08,  -3.726478e-13, 3.112159e+15,  3.573414e+17,  3.607559e+09,
        -2.923247e-19, -2.079346e+14, -4.611547e-16, 2.200040e+00,  3.670772e+07,  -4.176987e-20, 2.086575e+06,
        -2.388241e+01, -3.759717e-19, -2.232760e-01, 9.066157e-21,  2.797633e+07,  3.455296e+00,  -3.306761e-08,
        -2.062866e-22, -4.653724e+07, -3.694312e-17, 2.254095e-06,  3.519767e-16,  1.292737e-06,  -3.840896e-08,
        -1.946825e-20, 2.639141e+18,  3.021503e+07,  -1.834066e+18, 4.474920e-02,  3.005033e-20,  -1.233782e-10,
        -3.260111e-08, 2.326419e-09,  -2.298222e-19, 7.554873e+15,  2.378479e+19,  -5.092127e-03, -4.724838e-07,
        3.204184e+06,  2.713748e-12,  1.574309e-05,  6.622323e-01,  -4.944461e-01, -1.559672e+19, -3.350494e+15,
        2.467451e-14,  -4.881873e+13, 1.031263e+15,  -4.051814e+12, 1.418548e+07,  1.204368e+17,  -4.113152e-02,
        -4.472069e+16, 4.896886e-14,  2.371633e+05,  3.543019e+04,  -3.083516e-22, 1.041761e-09,  -2.579812e-06,
        -2.937567e+09, -4.775349e-16};
    EXPECT_RRARRAY_EQ(list_d5_1_1->Array, AttachRRArray(list_d5_1_1b, 100, false));

    // int list_d5_2_1a[]={10,20};
    // double list_d5_2_1b[]={ 2.792909e-01, 6.554477e+16, 4.240073e-13, -4.490109e+19, 5.410527e-22, -2.244599e+17,
    // -2.656142e-02, -3.819500e+13, -7.086082e-02, 7.790729e-13, 3.375900e-12, -6.915692e+09,
    // -2.900437e-18, 1.257280e+05, -3.810852e+15, -4.589554e-12, 2.670612e-14, 4.725686e+06,
    // -3.018046e+07, 2.439452e+07, 2.726039e-07, -2.805143e+02, -1.870376e+03, 4.573047e-06, 1.904868e+19,
    // -1.966383e+00, 3.426469e-11, -1.400396e+13, -1.724273e+09, -7.347198e+10, -4.081057e-12, -3.868203e+10,
    // -2.686071e+13, -5.289107e+01, -5.574151e-09, -2.580185e-06, -8.222097e-21, -4.957833e-12, -2.491984e+03,
    // -7.900042e+16, -4.809370e-11, -2.048332e-19, 4.984852e-21, 1.350023e+13, -4.492022e-11,
    // -3.255594e+10, 1.495149e-09, -7.272628e+02, -4.236196e-04, 4.736990e-02,
    // -4.030173e-11, 1.017371e+11, 1.124559e-09, 4.177431e-21, 1.026706e+06, -4.702729e-04, -2.633498e+18,
    // -4.689724e+08, -2.593657e+05, 3.433194e-18, -1.977738e-13,
    // -1.163773e+03, 3.424738e-20, 7.391132e-06, 1.364867e+12, -7.155727e+16, 3.078093e-21, -3.151787e-04,
    // -4.715633e+06, 1.017894e+19, -1.121778e+14, -3.529769e-10, 4.530606e+19, 3.988296e-17,
    // -3.469818e+06, 1.204304e+03, -1.404314e+15, -1.369871e+04, -2.796125e-03, -4.842068e-06,
    // -2.639632e-03, 1.324740e+08, 1.440651e+07, -4.778885e+03, -4.643859e+06, 1.726955e-09,
    // -8.160334e+05, 3.763238e+13, 1.391028e+02, -4.269393e+04, -2.698233e+02,
    // -3.677556e+14, 1.070699e-17, 3.949376e+19, 4.503080e-06, 4.344496e-07, 1.714091e-19, -3.436426e+01, 4.914505e+15,
    // -1.101617e+09, -1.899511e-04, 2.195951e-06, 2.402701e-12, 1.783431e-09,
    // -7.329137e-08, 4.423889e+16, 2.812547e-19, -7.848554e+05, -3.635151e+13, 3.128605e-09,
    // -2.858963e+08, 2.086065e-11, -2.544450e+12, 1.450579e+19,
    // -1.508905e+13, 4.307174e+00, 1.038108e-05, 4.313281e-05, 3.647351e+05, 1.309105e-16, 4.180469e+13, -2.701332e-07,
    // -4.033566e+14, -3.116748e-06, 2.342296e-07, 1.870335e-19, 2.312273e+01, -4.478923e+08,
    // -4.854324e+09, 2.681828e+03, -4.280128e-01, -4.690703e-21, 3.853815e+16, 1.366639e+02, -2.944985e-11,
    // -4.486958e-13, 3.017750e-11, 3.551437e-13, 2.263828e-12, -6.545014e-18,
    // -7.552023e+12, 7.595238e+14, 2.810247e+12, 6.516008e+15, -3.035786e+14, 2.523040e+11,
    // -3.766603e+09, 7.316287e+18, -2.147132e+17, 1.972210e+10, 2.906768e-13, 4.226577e-14,
    // -2.640568e+17, 2.181408e+10, -1.043256e-08, -3.649181e+06, -2.776638e+18, 3.660147e-07, -1.415433e-17,
    // -4.945127e-17, 2.655050e+01, -2.269828e+04, -2.585499e-01, -3.299965e+05, 3.707494e-18, -1.257923e-19,
    // -1.321880e+14, -1.815888e-12, 9.366926e-09, 1.024923e-14, 4.494907e+04, -2.596971e-20,
    // -3.403446e-12, 1.537084e+17, -3.850430e-17, -4.821759e+05, 4.255435e-20, -1.016978e-16, 1.430658e-09,
    // -3.696861e-14, -4.427905e-19, -1.999724e-09, -3.489402e-06, -4.677864e-03, 1.246884e+13,
    // -4.458271e-19, 3.551905e-04, -4.458221e-20, -3.472033e+01, -1.745714e+08, 4.396891e+03, 4.345767e+02,
    // -1.800116e+05, -1.217318e+00, 3.605072e-08, 1.306109e-09, -2.798295e+16, 4.387728e-13,
    // -3.284039e+11, 3.424124e+17 };
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > list_d5_2_1 =
        AllocateRRMultiDimArray<double>(AttachRRArray(is_d5_2_1a, 2, false), AttachRRArray(is_d5_2_1b, 200, false));
    RR_INTRUSIVE_PTR<RRList<RRMultiDimArray<double> > > list_d5_2 = AllocateEmptyRRList<RRMultiDimArray<double> >();
    list_d5_2->push_back(list_d5_2_1);
    EXPECT_NO_THROW(r->set_list_d5(list_d5_2));

    // Test list_str1

    // Test list_struct1

    RR_INTRUSIVE_PTR<RRList<teststruct2> > list_struct1_1 = r->get_list_struct1();
    double list_struct1_1a[] = {-9.692618e+00, -1.944240e+03, -2.456327e+16, 4.673405e-20,  5.147581e-14,
                                -3.773975e+15, 2.336430e-21,  1.597144e-18,  -2.609059e-03, 3.557639e-21,
                                -1.666575e-16, -4.242788e-07, 2.686206e+07,  -3.200902e-05, -1.549754e-06,
                                -3.010796e-12, 4.638418e+01,  2.664397e-14,  -2.689174e+01, 4.564584e-21};
    EXPECT_RRARRAY_EQ(list_struct1_1->front()->mydat, AttachRRArray(list_struct1_1a, 20, false));

    RR_INTRUSIVE_PTR<RRList<teststruct2> > list_struct1_2 = AllocateEmptyRRList<teststruct2>();
    RR_INTRUSIVE_PTR<teststruct2> list_struct1_2_1(new teststruct2());
    // double list_struct1_2_1a[]={ -2.101948e-07, -2.594836e-08, 2.515710e+01, -3.834127e-14, -3.088095e+06,
    // -3.256612e-02, -1.855481e-19, 3.801916e+07, 2.145894e+09, 4.487676e+12, 1.351202e-02,
    // -1.125124e-16, 1.369826e-20, -2.290673e+00, 1.786029e-20, -4.991515e+08, 4.006107e-10, -4.947871e-11,
    // -2.737020e-08, 4.123759e-20 };
    list_struct1_2_1->mydat = AttachRRArray(is_struct1_2_1a, 20, false);
    list_struct1_2->push_back(list_struct1_2_1);
    EXPECT_NO_THROW(r->set_list_struct1(list_struct1_2));

    // Test struct3
    double struct3a[] = {-8.483090e-19, -4.401548e-08, 3.908118e+00,  2.063513e-18,  4.237047e+18,
                         -1.124681e-16, 3.924541e-01,  -2.184335e-10, -1.978950e+11, 1.586365e+18,
                         1.712393e+00,  -6.314723e+00, 1.196777e-16,  -2.748704e-08, -1.289967e+02,
                         -4.051137e+17, -1.902860e+10, -2.070486e+08, 3.622651e+06,  1.315398e+17};
    EXPECT_RRARRAY_EQ(r->get_struct3()->a1, AttachRRArray(struct3a, 20, false));

    RR_INTRUSIVE_PTR<ostruct2> struct3_1(new ostruct2());
    double struct3_1a[] = {-2.426765e+05, -9.410735e+01, -1.667915e+12, -4.084240e-05, 3.199460e+03,
                           8.256717e-12,  -4.772119e-11, -1.061407e-13, 2.759750e+02,  -1.212549e+10,
                           7.012690e+15,  3.953354e+04,  -2.617985e-07, 1.104408e-21,  -3.889366e+00,
                           4.549493e+16,  -1.376791e+15, -3.445205e-21, 2.137830e-14,  4.620179e+18};
    struct3_1->a1 = AttachRRArray(struct3_1a, 20, false);
    EXPECT_NO_THROW(r->set_struct3(struct3_1));

    // Test var1  TODO...

    // Test var2 TODO...

    // Test var_num
    int32_t var_numa[] = {-1680284833, -54562307, 732107275,  1470526962, -1389452949,
                          256801409,   261288152, 1728150828, 1322531658, -1640628174,
                          1036878614,  511108054, 2057847386, 288780916,  996595759};
    EXPECT_RRARRAY_EQ(rr_cast<RRArray<int32_t> >(r->get_var_num()), AttachRRArray(var_numa, 15, false));
    int32_t var_numb[] = {-1046369769, 1950632347, 1140727074, -1277424443, 163999900,
                          970815027,   545593183,  514305170,  1896372264,  1385916382};
    EXPECT_NO_THROW(r->set_var_num(AttachRRArray(var_numb, 10, false)));

    // Test var_str
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToString(rr_cast<RRArray<char> >(r->get_var_str())), "Hello Client!"));
    EXPECT_NO_THROW(r->set_var_str(stringToRRArray("Hello Server!")));

    // Test var_struct

    double var_structa[] = {-9.052731e+13, 4.151705e-17,  -4.004463e+19, -2.838274e+03, 9.983314e+12,
                            2.764122e+10,  -1.131486e+03, 2.418899e+12,  1.323675e-05,  -4.602174e+13,
                            2.717530e+01,  1.193887e-10,  -4.137578e+16, -1.246990e-19, 4.244315e-18,
                            -2.833005e-08, 1.956266e-04,  4.130129e-21,  1.641708e-11,  -4.488158e-19};
    EXPECT_RRARRAY_EQ(rr_cast<teststruct2>(r->get_var_struct())->mydat, AttachRRArray(var_structa, 20, false));

    RR_INTRUSIVE_PTR<teststruct2> var_struct_1(new teststruct2());
    double var_struct1_1a[] = {-4.945426e-20, 1.763386e+13,  3.431578e-04,  4.411409e+17,  -2.690201e+03,
                               3.025939e-10,  -3.659846e+11, -4.780435e-10, -3.246816e+14, -1.815578e+04,
                               2.236455e+10,  -4.639041e+14, 1.767930e+10,  -1.636094e+05, -4.392462e-01,
                               2.225260e+04,  -5.250245e+18, 8.755282e-12,  2.005819e-10,  2.702210e+04};
    var_struct_1->mydat = AttachRRArray(var_struct1_1a, 20, false);
    EXPECT_NO_THROW(r->set_var_struct(var_struct_1));
    // TODO: add in all the other test values

    // Test var_vector
    EXPECT_NO_THROW(EXPECT_EQ(
        RRArrayToString(rr_cast<RRArray<char> >(rr_cast<RRMap<int32_t, RRValue> >(r->get_var_vector())->at(10))),
        "Hello Client!"));
    RR_INTRUSIVE_PTR<RRMap<int32_t, RRValue> > var_vector_1 = AllocateEmptyRRMap<int32_t, RRValue>();
    var_vector_1->insert(make_pair(11, stringToRRArray("Hello Server!")));
    EXPECT_NO_THROW(r->set_var_vector(var_vector_1));

    // Test var_dictionary
    EXPECT_NO_THROW(EXPECT_EQ(RRArrayToString(rr_cast<RRArray<char> >(
                                  rr_cast<RRMap<string, RRValue> >(r->get_var_dictionary())->at("test1"))),
                              "Hello Client!"));
    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > var_dictionary_1 = AllocateEmptyRRMap<string, RRValue>();
    var_dictionary_1->insert(make_pair("test2", stringToRRArray("Hello Server!")));
    EXPECT_NO_THROW(r->set_var_dictionary(var_dictionary_1));

    // Test var_list
    EXPECT_NO_THROW(
        EXPECT_EQ(RRArrayToString(rr_cast<RRArray<char> >(rr_cast<RRList<RRValue> >(r->get_var_list())->front())),
                  "Hello Client!"));
    RR_INTRUSIVE_PTR<RRList<RRValue> > var_list_1 = AllocateEmptyRRList<RRValue>();
    var_list_1->push_back(stringToRRArray("Hello Server!"));
    EXPECT_NO_THROW(r->set_var_list(var_list_1));

    // Test var_multidimarray
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > var_a_1 = rr_cast<RRMultiDimArray<double> >(r->get_var_multidimarray());
    uint32_t var_a_1a[] = {5, 4};
    EXPECT_RRARRAY_EQ(var_a_1->Dims, AttachRRArray(var_a_1a, 2, false));
    double var_a_1b[] = {-4.915597e-01, 3.892823e+00,  2.622325e+08,  -7.150935e+04, 9.418756e+00,
                         3.633879e+18,  3.522383e-03,  -4.989811e+05, 2.027383e-03,  -3.153241e+12,
                         -6.948245e-21, -3.198577e+14, 6.172905e+09,  3.849430e+15,  8.600383e+13,
                         4.079437e-17,  3.194775e+06,  4.222550e-18,  1.758122e+17,  -1.018308e+03};
    EXPECT_RRARRAY_EQ(var_a_1->Array, AttachRRArray(var_a_1b, 20, false));
    uint32_t var_a_2a[] = {5, 4};
    double var_a_2b[] = {3.792953e+00,  2.968121e-17,  -3.976413e-15, 4.392986e+19,  2.197463e+10,
                         -2.627743e-14, -2.184665e+17, 1.972257e-17,  9.929684e-03,  -3.096821e+17,
                         3.598051e+11,  -6.266015e-18, 1.811985e-11,  2.815232e-07,  7.469467e-06,
                         6.141798e+13,  3.105763e+09,  -1.697809e-10, -4.141707e-17, 4.391634e+13};
    EXPECT_NO_THROW(r->set_var_multidimarray(
        AllocateRRMultiDimArray<double>(AttachRRArray(var_a_2a, 2, false), AttachRRArray(var_a_2b, 20, false))));

    // Test errtest and make sure an std::exception is thrown

    EXPECT_THROW(r->set_errtest(1), RobotRaconteurException);
    EXPECT_THROW(r->get_errtest(), RobotRaconteurException);

    // Test nulltest
    EXPECT_NO_THROW(EXPECT_FALSE(r->get_nulltest()));
    EXPECT_NO_THROW(r->set_nulltest(RR_INTRUSIVE_PTR<teststruct1>()));
}

void ServiceTestClient::TestFunctions()
{
    EXPECT_NO_THROW(r->func1());
    EXPECT_NO_THROW(r->func2(10, 20.34));
    EXPECT_NO_THROW(EXPECT_EQ(r->func3(2, 3.45), 5.45));
    EXPECT_NO_THROW(EXPECT_EQ(r->meaning_of_life(), 42));

    EXPECT_THROW(r->func_errtest(), RobotRaconteurRemoteException);
    EXPECT_THROW(r->func_errtest1(), DataTypeException);
    EXPECT_THROW(r->func_errtest2(), testexception1);
    EXPECT_THROW(r->func_errtest3(), testexception3);
}

void ServiceTestClient::TestEvents()
{

    boost::signals2::connection c1 = r->get_ev1().connect(boost::bind(&ServiceTestClient::ev1_cb, this));
    boost::signals2::connection c2 = r->get_ev2().connect(
        boost::bind(&ServiceTestClient::ev2_cb, this, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2)));

    EXPECT_NO_THROW(r->func1());
    EXPECT_NO_THROW(r->func2(27.3, 98.23));

    EXPECT_TRUE(ev1_event.WaitOne(2000));
    EXPECT_TRUE(ev2_event.WaitOne(2000));

    c1.disconnect();
    c2.disconnect();
    r->get_ev1().empty();
    r->get_ev2().empty();
}

void ServiceTestClient::ev1_cb() { ev1_event.Set(); }

void ServiceTestClient::ev2_cb(double d, RR_INTRUSIVE_PTR<teststruct2> s)
{
    if (d == 27.3 && (*s->mydat)[0] == 98.23)
    {
        ev2_event.Set();
    }
}

#define ShouldBeErr_Timeout(COMMAND, TIMEOUT)                                                                          \
    {                                                                                                                  \
        boost::posix_time::ptime should_be_err_timeout_start = boost::posix_time::microsec_clock::universal_time();    \
        boost::posix_time::ptime should_be_err_timeout_end =                                                           \
            should_be_err_timeout_start + boost::posix_time::milliseconds(TIMEOUT);                                    \
        while (true)                                                                                                   \
        {                                                                                                              \
            bool err = false;                                                                                          \
            try                                                                                                        \
            {                                                                                                          \
                COMMAND                                                                                                \
            }                                                                                                          \
            catch (std::exception&)                                                                                    \
            {                                                                                                          \
                err = true;                                                                                            \
                break;                                                                                                 \
            };                                                                                                         \
            if (err == false && boost::posix_time::microsec_clock::universal_time() > should_be_err_timeout_end)       \
                FAIL();                                                                                                \
        }                                                                                                              \
    }

#define ShouldNotBeErr_Timeout(COMMAND, TIMEOUT)                                                                       \
    {                                                                                                                  \
        boost::posix_time::ptime should_be_err_timeout_start = boost::posix_time::microsec_clock::universal_time();    \
        boost::posix_time::ptime should_be_err_timeout_end =                                                           \
            should_be_err_timeout_start + boost::posix_time::milliseconds(TIMEOUT);                                    \
        while (true)                                                                                                   \
        {                                                                                                              \
            try                                                                                                        \
            {                                                                                                          \
                COMMAND;                                                                                               \
                break;                                                                                                 \
            }                                                                                                          \
            catch (std::exception&)                                                                                    \
            {}                                                                                                         \
            if (boost::posix_time::microsec_clock::universal_time() > should_be_err_timeout_end)                       \
            {                                                                                                          \
                EXPECT_NO_THROW(COMMAND);                                                                              \
                break;                                                                                                 \
            }                                                                                                          \
        }                                                                                                              \
    }

void ServiceTestClient::TestObjRefs()
{
    RR_SHARED_PTR<sub1> o1;
    RR_SHARED_PTR<sub1> o2_10;
    RR_SHARED_PTR<sub1> o2_34;
    RR_SHARED_PTR<sub1> o3_1;
    RR_SHARED_PTR<sub1> o4_myind;
    RR_SHARED_PTR<sub1> o4_specialind;

    RR_SHARED_PTR<sub2> o2_10_o2_1_32;

    RR_SHARED_PTR<sub3> o2_10_o2_1_32_o3_ind1;
    RR_SHARED_PTR<sub3> o2_10_o2_1_32_o3_ind2;

    EXPECT_NO_THROW(o1 = r->get_o1());
    EXPECT_NO_THROW(o2_10 = r->get_o2(10));
    EXPECT_NO_THROW(o2_34 = r->get_o2(34));
    EXPECT_NO_THROW(o3_1 = r->get_o3(1));
    EXPECT_NO_THROW(o4_myind = r->get_o4("myind"));
    EXPECT_NO_THROW(o4_specialind = r->get_o4("ind!@#$%^&*().<>     "));

    EXPECT_NO_THROW(o2_10_o2_1_32 = o2_10->get_o2_2(32));

    EXPECT_NO_THROW(o2_10_o2_1_32_o3_ind1 = o2_10_o2_1_32->get_o3_1("ind1"));
    EXPECT_NO_THROW(o2_10_o2_1_32_o3_ind2 = o2_10_o2_1_32->get_o3_1("ind2"));

    double o_d1a[] = {-2.086627e+06, 3.092642e+04,  -1.981667e+02, 1.963286e-20, 4.264052e-08,
                      3.594320e+12,  -4.820517e-02, -3.629590e+06, 6.037089e-07, 3.328419e+06};
    EXPECT_NO_THROW(o1->set_d1(AttachRRArray(o_d1a, 10, false)));
    double o_d1b[] = {4.978178e-14,  2.867603e-17,  4.471047e-21,  -2.002902e+15, -2.910881e-03,
                      -2.601092e-03, -3.043199e+16, -3.257109e-12, 1.834255e-11,  -3.383015e+00};
    EXPECT_NO_THROW(o2_10->set_d1(AttachRRArray(o_d1b, 10, false)));
    double o_d1c[] = {4.661927e-02,  2.334444e+02, 3.985567e+12, -2.324843e+01, -3.315866e+03,
                      -4.442404e+10, 3.280626e-02, 2.334668e-12, -3.374202e-14, 4.809260e+02};
    EXPECT_NO_THROW(o2_34->set_d1(AttachRRArray(o_d1c, 10, false)));
    double o_d1d[] = {-1.882441e-04, 2.065458e+14, -6.309214e-16, -3.181637e-07, -9.906616e+02,
                      1.684926e-14,  1.672252e+15, -3.950901e+01, -3.295950e-17, -3.080902e+13};
    EXPECT_NO_THROW(o3_1->set_d1(AttachRRArray(o_d1d, 10, false)));
    double o_d1e[] = {2.997950e-14,  -1.077977e+17, 3.721399e-09, -1.289619e+18, 4.494844e+06,
                      -4.918719e-15, 2.194759e+13,  2.554572e-09, 4.166299e-06,  -1.409589e+04};
    EXPECT_NO_THROW(o4_myind->set_d1(AttachRRArray(o_d1e, 10, false)));
    double o_d1f[] = {3.404179e-08,  -1.749189e-18, -3.219593e-09, 1.313794e+01,  -4.193673e+10,
                      -2.479829e+07, -2.617068e+04, 8.181730e+15,  -2.003653e+18, -1.833401e+19};
    EXPECT_NO_THROW(o4_specialind->set_d1(AttachRRArray(o_d1f, 10, false)));
    EXPECT_NO_THROW(o2_10_o2_1_32->set_data("Hello world!"));
    EXPECT_NO_THROW(o2_10_o2_1_32_o3_ind1->set_data2("Test string 1"));
    EXPECT_NO_THROW(o2_10_o2_1_32_o3_ind2->set_data2("Test string 2"));
    EXPECT_EQ(o2_10_o2_1_32_o3_ind2->add(10), 52);

    // Test the varobject type and make sure the ReleaseServicePath works...

    RR_SHARED_PTR<sub1> o6_1;
    RR_SHARED_PTR<sub2> o6_1_1;

    EXPECT_NO_THROW(r->o6_op(0));
    ShouldNotBeErr_Timeout(
        {
            o6_1 = rr_cast<sub1>(r->get_o6());
            o6_1_1 = o6_1->get_o2_1();
            o6_1->set_d1(ScalarToRRArray(0.0));
            o6_1_1->set_data("Hello world!");
        },
        500);

    EXPECT_NO_THROW(r->o6_op(1));
    ShouldBeErr_Timeout({ o6_1->set_d1(ScalarToRRArray(0.0)); }, 1000);
    ShouldBeErr_Timeout({ o6_1_1->set_data("Hello world!"); }, 1000);

    RR_SHARED_PTR<sub2> o6_2 = rr_cast<sub2>(r->get_o6());
    EXPECT_NO_THROW(o6_2->set_data("Hello world!"));

    EXPECT_NO_THROW(r->o6_op(2));
    ShouldBeErr_Timeout({ o6_2->set_data("Hello world!"); }, 1000);

    RR_SHARED_PTR<com::robotraconteur::testing::TestService2::subobj> o6_3 =
        rr_cast<com::robotraconteur::testing::TestService2::subobj>(r->get_o6());
    EXPECT_NO_THROW(o6_3->add_val(2));
}

void ServiceTestClient::TestCallbacks()
{
    cb1_called = false;
    cb2_called = false;
    cb3_called = false;
    cb4_called = false;
    cb5_called = false;

    r->get_cb1()->SetFunction(boost::bind(&ServiceTestClient::cb1_func, this));
    r->get_cb2()->SetFunction(
        boost::bind(&ServiceTestClient::cb2_func, this, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2)));
    r->get_cb3()->SetFunction(
        boost::bind(&ServiceTestClient::cb3_func, this, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2)));
    r->get_cb_meaning_of_life()->SetFunction(boost::bind(&ServiceTestClient::cb_meaning_of_life_func, this));
    r->get_cb_errtest()->SetFunction(boost::bind(&ServiceTestClient::cb_errtest, this));

    EXPECT_NO_THROW(r->test_callbacks());

    EXPECT_FALSE(!cb1_called || !cb2_called || !cb3_called || !cb4_called || !cb5_called);
}

void ServiceTestClient::cb1_func() { cb1_called = true; }

void ServiceTestClient::cb2_func(double d1, double d2)
{
    if (d1 != 739.2 || d2 != 0.392)
        throw std::exception();
    cb2_called = true;
}

double ServiceTestClient::cb3_func(double d1, double d2)
{
    cb3_called = true;
    return d1 + d2 + 3.14;
}

int ServiceTestClient::cb_meaning_of_life_func()
{
    cb4_called = true;
    return 42;
}

void ServiceTestClient::cb_errtest()
{
    cb5_called = true;
    throw runtime_error("This is a test");
}

void ServiceTestClient::TestPipes()
{
    RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > e1;
    RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > e2;
    RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<teststruct2> > > e3;

    ASSERT_NO_THROW(e1 = r->get_p1()->Connect(-1));
    ASSERT_NO_THROW(e2 = r->get_p1()->Connect(3432));
    ASSERT_NO_THROW(e3 = r->get_p2()->Connect(-1));

    e1->SetRequestPacketAck(true);

    boost::signals2::connection ec1 =
        e1->PacketReceivedEvent.connect(boost::bind(&ServiceTestClient::ee1_cb, this, RR_BOOST_PLACEHOLDERS(_1)));
    boost::signals2::connection ec2 = e1->PacketAckReceivedEvent.connect(
        boost::bind(&ServiceTestClient::ee1_ack_cb, this, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2)));
    boost::signals2::connection ec3 =
        e2->PacketReceivedEvent.connect(boost::bind(&ServiceTestClient::ee2_cb, this, RR_BOOST_PLACEHOLDERS(_1)));
    boost::signals2::connection ec4 =
        e3->PacketReceivedEvent.connect(boost::bind(&ServiceTestClient::ee3_cb, this, RR_BOOST_PLACEHOLDERS(_1)));

    double d1[] = {1, 2, 3, 4};
    double d2[] = {5, 6, 7, 8};
    double d3[] = {-1, -2, -3, -5.32};
    double d4[] = {3.21};
    double d5[] = {4.72};
    double d6[] = {72.34};
    double d7[] = {738.29};
    double d8[] = {89.83};
    {
        boost::mutex::scoped_lock lock(pipe_ack_lock);
        EXPECT_NO_THROW(packetnum = e1->SendPacket(AttachRRArray(d1, 4, false)));
    }
    EXPECT_NO_THROW(e1->SendPacket(AttachRRArray(d2, 4, false)));
    EXPECT_NO_THROW(e1->SendPacket(AttachRRArray(d3, 4, false)));

    EXPECT_NO_THROW(e2->SendPacket(AttachRRArray(d4, 1, false)));
    EXPECT_NO_THROW(e2->SendPacket(AttachRRArray(d5, 1, false)));
    EXPECT_NO_THROW(e2->SendPacket(AttachRRArray(d6, 1, false)));

    RR_INTRUSIVE_PTR<teststruct2> s1(new teststruct2());
    s1->mydat = AttachRRArray(d7, 1, false);
    RR_INTRUSIVE_PTR<teststruct2> s2(new teststruct2());
    s2->mydat = AttachRRArray(d8, 1, false);

    EXPECT_NO_THROW(e3->SendPacket(s1));
    EXPECT_NO_THROW(e3->SendPacket(s2));

    EXPECT_RRARRAY_EQ(e1->ReceivePacketWait(5000), AttachRRArray(d1, 4, false));
    EXPECT_RRARRAY_EQ(e1->ReceivePacketWait(5000), AttachRRArray(d2, 4, false));

    RR_INTRUSIVE_PTR<RRArray<double> > e1_3_1;
    RR_INTRUSIVE_PTR<RRArray<double> > e1_3_2;
    EXPECT_TRUE(e1->TryReceivePacketWait(e1_3_1, 5000, true));
    EXPECT_TRUE(e1->TryReceivePacketWait(e1_3_2, 5000, true));

    EXPECT_RRARRAY_EQ(e1_3_1, AttachRRArray(d3, 4, false));
    EXPECT_RRARRAY_EQ(e1_3_2, AttachRRArray(d3, 4, false));

    EXPECT_TRUE(ee2.WaitOne(5000));
    EXPECT_TRUE(ee3.WaitOne(5000));

    EXPECT_RRARRAY_EQ(e2->ReceivePacket(), AttachRRArray(d4, 1, false));
    EXPECT_RRARRAY_EQ(e2->ReceivePacketWait(100), AttachRRArray(d5, 1, false));
    EXPECT_RRARRAY_EQ(e2->ReceivePacketWait(100), AttachRRArray(d6, 1, false));

    EXPECT_RRARRAY_EQ(e3->ReceivePacket()->mydat, AttachRRArray(d7, 1, false));
    EXPECT_RRARRAY_EQ(e3->ReceivePacketWait(100)->mydat, AttachRRArray(d8, 1, false));

    ShouldNotBeErr_Timeout({ r->pipe_check_error(); }, 1000);

    EXPECT_NO_THROW(e1->Close());
    // e2->Close();
    EXPECT_NO_THROW(e3->Close());

    ec1.disconnect();
    ec2.disconnect();
    ec3.disconnect();
    ec4.disconnect();
}

void ServiceTestClient::ee1_cb(RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > p) { ee1.Set(); }

void ServiceTestClient::ee1_ack_cb(RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > p,
                                   uint32_t packetnum)
{
    boost::mutex::scoped_lock lock(pipe_ack_lock);
    if (packetnum == this->packetnum)
        ack_recv = true;
}

void ServiceTestClient::ee2_cb(RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > p) { ee2.Set(); }

void ServiceTestClient::ee3_cb(RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<teststruct2> > > p) { ee3.Set(); }

void ServiceTestClient::TestWires()
{
    w1_called = false;
    w2_called = false;
    w3_called = false;

    RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRArray<double> > > > w1;
    RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<teststruct2> > > w2;
    RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRMultiDimArray<int32_t> > > > w3;

    ASSERT_NO_THROW(w1 = r->get_w1()->Connect());
    ASSERT_NO_THROW(w2 = r->get_w2()->Connect());
    ASSERT_NO_THROW(w3 = r->get_w3()->Connect());

    w1->WireValueChanged.connect(boost::bind(&ServiceTestClient::w1_changed, this, RR_BOOST_PLACEHOLDERS(_1),
                                             RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3)));
    w2->WireValueChanged.connect(boost::bind(&ServiceTestClient::w2_changed, this, RR_BOOST_PLACEHOLDERS(_1),
                                             RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3)));
    w3->WireValueChanged.connect(boost::bind(&ServiceTestClient::w3_changed, this, RR_BOOST_PLACEHOLDERS(_1),
                                             RR_BOOST_PLACEHOLDERS(_2), RR_BOOST_PLACEHOLDERS(_3)));

    w1->SetInValueLifespan(10000);

    double d0[] = {0.0};
    EXPECT_NO_THROW(w1->SetOutValue(AttachRRArrayCopy(d0, 1)));

    RR_INTRUSIVE_PTR<teststruct2> s1(new teststruct2());
    s1->mydat = AttachRRArrayCopy(d0, 1);
    EXPECT_NO_THROW(w2->SetOutValue(s1));

    int32_t i0[] = {0};
    uint32_t i1[] = {1, 1};
    EXPECT_NO_THROW(
        w3->SetOutValue(AllocateRRMultiDimArray<int32_t>(AttachRRArrayCopy(i1, 2), AttachRRArrayCopy(i0, 1))));

    double d1[] = {-2.377683e+02, -6.760080e-08, 4.191315e-18,  -4.621977e+07, -1.570323e+03,
                   -4.163378e+03, -2.506701e+13, -4.755701e+18, -1.972380e-19, 1.791593e-11};
    EXPECT_NO_THROW(w1->SetOutValue(AttachRRArrayCopy(d1, 10)));

    RR_INTRUSIVE_PTR<teststruct2> s2(new teststruct2());
    double d2[] = {-1.014645e-21, 4.743740e+11,  5.804886e-04,  2.963852e-20, 4.277621e-21,
                   -1.168151e+13, -2.638708e-18, -5.123312e+14, 1.261123e-05, 2.552626e-10};
    s2->mydat = AttachRRArrayCopy(d2, 10);
    EXPECT_NO_THROW(w2->SetOutValue(s2));

    uint32_t i2[] = {2, 5};
    int32_t i3[] = {2058500854, -611248192, 197490486,  -517717939,  -513450368,
                    296469979,  645365194,  2043654604, -1672941174, 710030901};
    RR_INTRUSIVE_PTR<RRMultiDimArray<int32_t> > a2 =
        AllocateRRMultiDimArray<int32_t>(AttachRRArrayCopy(i2, 2), AttachRRArrayCopy(i3, 10));
    EXPECT_NO_THROW(w3->SetOutValue(a2));

    // boost::this_thread::sleep(boost::posix_time::milliseconds(100));

    EXPECT_NO_THROW(w1->WaitInValueValid());

    // if (!we1.WaitOne(5000)) throw std::exception();
    EXPECT_TRUE(we2.WaitOne(5000));
    EXPECT_TRUE(we3.WaitOne(5000));

    double d3[] = {-2.377683e+02, -6.760080e-08, 4.191315e-18,  -4.621977e+07, -1.570323e+03,
                   -4.163378e+03, -2.506701e+13, -4.755701e+18, -1.972380e-19, 1.791593e-11};

    ShouldNotBeErr_Timeout(
        {
            w1->SetOutValue(AttachRRArrayCopy(d1, 10));
            boost::this_thread::sleep(boost::posix_time::milliseconds(5));
            RR_INTRUSIVE_PTR<RRArray<double> > in1;
            TimeSpec in1_time;
            if (!w1->TryGetInValue(in1, in1_time))
            {
                throw std::runtime_error("TryGetInValue failed");
            }
            ca(AttachRRArray(d3, 10, false), in1);
        },
        1000);

    double d4[] = {-1.014645e-21, 4.743740e+11,  5.804886e-04,  2.963852e-20, 4.277621e-21,
                   -1.168151e+13, -2.638708e-18, -5.123312e+14, 1.261123e-05, 2.552626e-10};
    ShouldNotBeErr_Timeout(
        {
            w2->SetOutValue(s2);
            boost::this_thread::sleep(boost::posix_time::milliseconds(5));
            RR_INTRUSIVE_PTR<teststruct2> in2 = w2->GetInValue();
            ca(in2->mydat, AttachRRArray(d4, 10, false));
        },
        500);

    int32_t i4[] = {2058500854, -611248192, 197490486,  -517717939,  -513450368,
                    296469979,  645365194,  2043654604, -1672941174, 710030901};

    ShouldNotBeErr_Timeout(
        {
            w3->SetOutValue(a2);
            RR_INTRUSIVE_PTR<RRMultiDimArray<int32_t> > in3 = w3->GetInValue();
            ca(in3->Dims, AttachRRArray(i2, 2, false));
            ca(in3->Array, AttachRRArray(i4, 10, false));
        },
        500);

    EXPECT_FALSE(!w1_called || !w2_called || !w3_called);

    w1->SetInValueLifespan(1);
    boost::this_thread::sleep(boost::posix_time::milliseconds(5));
    EXPECT_THROW(w1->GetInValue();, std::exception);

    EXPECT_NO_THROW(w1->Close());
    // w2->Close();
    EXPECT_NO_THROW(w3->Close());
}

void ServiceTestClient::w1_changed(RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRArray<double> > > > c,
                                   RR_INTRUSIVE_PTR<RRArray<double> > value, TimeSpec t)
{
    w1_called = true;
    we1.Set();
}

void ServiceTestClient::w2_changed(RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<teststruct2> > > c,
                                   RR_INTRUSIVE_PTR<teststruct2> value, TimeSpec t)
{
    w2_called = true;
    we2.Set();
}

void ServiceTestClient::w3_changed(RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRMultiDimArray<int32_t> > > > c,
                                   RR_INTRUSIVE_PTR<RRMultiDimArray<int32_t> > value, TimeSpec t)
{
    w3_called = true;
    we3.Set();
}

void ServiceTestClient::TestMemories()
{
    test_m1();
    test_m2();
    test_m3();
}

void ServiceTestClient::test_m1()
{
    EXPECT_NO_THROW(EXPECT_EQ(r->get_m1()->Length(), 100));
    RR_INTRUSIVE_PTR<RRArray<double> > m1_1 = AllocateRRArray<double>(11);
    memset(m1_1->data(), 0, 11 * sizeof(11));
    EXPECT_NO_THROW(r->get_m1()->Read(10, m1_1, 1, 10));
    double m1_1a[] = {0,
                      -1.478723e-16,
                      1.507042e-05,
                      -2.046271e+13,
                      4.014775e+06,
                      4.140740e+10,
                      1.318907e+16,
                      -2.312403e+17,
                      4.463696e-13,
                      9.173421e-04,
                      6.169183e-21};
    EXPECT_RRARRAY_EQ(m1_1, AttachRRArray(m1_1a, 11, false));
    double m1_2a[] = {3.462892e+10, -1.149841e-18, 4.649317e-15,  -3.632280e-19, -5.252280e+07, 1.800453e-07,
                      3.772468e-04, -1.911891e+09, -3.018967e-14, 4.835062e-06,  5.269663e+13,  4.946221e+03};
    RR_INTRUSIVE_PTR<RRArray<double> > m1_2 = AttachRRArray(m1_2a, 12, false);
    EXPECT_NO_THROW(r->get_m1()->Write(20, m1_2, 2, 8));

    RR_INTRUSIVE_PTR<RRArray<double> > m1_3 = AllocateRRArray<double>(100);
    EXPECT_NO_THROW(r->get_m1()->Read(0, m1_3, 0, 100));

    double m1_4a[] = {
        -2.675014e-13, 6.884672e-07,  4.855899e-02,  1.634267e-08,  -5.346105e+06, 9.245749e+09,  2.174639e+16,
        -3.574166e+04, 3.063678e+16,  4.748279e-16,  -1.478723e-16, 1.507042e-05,  -2.046271e+13, 4.014775e+06,
        4.140740e+10,  1.318907e+16,  -2.312403e+17, 4.463696e-13,  9.173421e-04,  6.169183e-21,  3.643045e+09,
        -3.784476e+13, -1.878617e-21, -4.122785e+01, -2.477761e+15, -5.220540e-11, -3.930894e-19, 3.980082e-12,
        -3.681569e-20, 4.675366e+19,  -7.454667e-06, -1.529932e+17, -3.707663e-04, -3.356188e-20, -2.393304e-07,
        1.339372e-18,  -3.735916e-15, 1.715447e+01,  1.316085e+02,  9.603036e-05,  1.458992e+16,  9.228113e+11,
        1.099841e-12,  -2.484793e-09, 4.826956e-19,  -3.662630e-11, -3.274562e+10, 1.866042e-12,  4.061219e-13,
        1.307997e-18,  -1.210979e+08, 4.036328e+02,  -2.713849e-11, -3.673995e-01, -4.576021e+03, 1.519751e+03,
        1.792427e-16,  -2.033399e+18, 4.341947e+08,  -1.699292e-09, -1.007978e-21, 3.200139e-15,  -3.157557e+03,
        -3.717883e-15, 4.337614e+02,  -3.666534e-12, -1.821013e-14, -2.260577e-20, 1.722045e-06,  1.886614e+00,
        -1.278609e+15, 2.923499e-03,  4.969081e+02,  4.438380e-06,  -3.890489e-11, -3.261564e-17, 6.172945e-10,
        4.951740e+19,  3.460327e+11,  -3.600349e-16, 2.419445e+11,  -9.124824e+10, 4.127522e+04,  1.443468e+00,
        -3.968841e-21, -2.507203e+05, 2.214239e+13,  -3.327687e+07, 1.167160e+09,  -4.361249e-11, -4.609514e+14,
        -2.461408e+13, 5.584758e+06,  3.989706e-07,  2.597151e-12,  -2.961640e+08, -2.173964e-02, -1.866864e-11,
        4.832786e-08,  2.713705e-07};
    memcpy((m1_4a + 20), (m1_2a + 2), 8 * sizeof(double));
    EXPECT_RRARRAY_EQ(m1_3, AttachRRArray(m1_4a, 100, false));
}

void ServiceTestClient::test_m2()
{
    EXPECT_NO_THROW(EXPECT_EQ(r->get_m2()->DimCount(), 5));
    vector<uint64_t> m2_dims = r->get_m2()->Dimensions();
    uint64_t m2_dimsa[] = {10, 10, 10, 10, 10};
    EXPECT_RRVECTOR_EQ(m2_dims, vector<uint64_t>(m2_dimsa, m2_dimsa + 5));

    LFSRSeqGen rng((uint32_t)std::time(0), "multidimarray_test_double");
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m1 =
        FillMultiDimArray<double>(rng, boost::assign::list_of(10)(10)(10)(10)(10));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m2 =
        FillMultiDimArray<double>(rng, boost::assign::list_of(2)(8)(8)(2)(2));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m2_1 =
        GetMultiDimArraySub(m2, boost::assign::list_of(0)(2)(0)(0)(0), boost::assign::list_of(1)(5)(5)(2)(1));
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m3 = TestingCopyMultiDimArray(m1);
    SetMultiDimArraySub(m3, boost::assign::list_of(2)(2)(3)(3)(4), m2_1);
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m4 =
        GetMultiDimArraySub(m3, boost::assign::list_of(4)(2)(2)(8)(0), boost::assign::list_of(2)(2)(1)(1)(10));
    uint32_t m5a[] = {4, 4, 4, 4, 10};
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m5 =
        AllocateRRMultiDimArray<double>(AttachRRArray(m5a, 5, false), AllocateEmptyRRArray<double>(2560));
    SetMultiDimArraySub(m5, boost::assign::list_of(2)(1)(2)(1)(0), m4);

    uint64_t zeros[] = {0, 0, 0, 0, 0};
    vector<uint64_t> vzeros(zeros, zeros + 5);
    EXPECT_NO_THROW(r->get_m2()->Write(vzeros, m1, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));

    uint32_t zeros2[] = {0, 0, 0, 0, 0};
    uint32_t tens[] = {10, 10, 10, 10, 10};
    RR_INTRUSIVE_PTR<RRArray<uint32_t> > vzeros2 = AttachRRArrayCopy(zeros2, 5);
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m1_2 =
        AllocateRRMultiDimArray<double>(AttachRRArray(tens, 5, false), AllocateRRArray<double>(100000));
    EXPECT_NO_THROW(r->get_m2()->Read(vzeros, m1_2, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));
    EXPECT_RRARRAY_EQ(m1->Dims, m1_2->Dims);
    EXPECT_RRARRAY_EQ(m1->Array, m1_2->Array);

    uint64_t m1a[] = {2, 2, 3, 3, 4};
    uint64_t m1b[] = {0, 2, 0, 0, 0};
    uint64_t m1c[] = {1, 5, 5, 2, 1};
    EXPECT_NO_THROW(r->get_m2()->Write(vector<uint64_t>(m1a, m1a + 5), m2, vector<uint64_t>(m1b, m1b + 5),
                                       vector<uint64_t>(m1c, m1c + 5)));

    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m2_2 =
        AllocateRRMultiDimArray<double>(AttachRRArray(tens, 5, false), AllocateRRArray<double>(100000));
    EXPECT_NO_THROW(r->get_m2()->Read(vzeros, m2_2, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));
    EXPECT_RRARRAY_EQ(m2_2->Dims, m3->Dims);
    EXPECT_RRARRAY_EQ(m2_2->Array, m3->Array);

    uint32_t m6a[] = {2, 2, 1, 1, 10};
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m6 =
        AllocateRRMultiDimArray<double>(AttachRRArray(m6a, 5, false), AllocateRRArray<double>(40));
    uint64_t m4a[] = {4, 2, 2, 8, 0};
    uint64_t m4b[] = {0, 0, 0, 0, 0};
    uint64_t m4c[] = {2, 2, 1, 1, 10};
    EXPECT_NO_THROW(r->get_m2()->Read(vector<uint64_t>(m4a, m4a + 5), m6, vector<uint64_t>(m4b, m4b + 5),
                                      vector<uint64_t>(m4c, m4c + 5)));
    EXPECT_RRARRAY_EQ(m4->Array, m6->Array);

    uint32_t m7a[] = {4, 4, 4, 4, 10};
    RR_INTRUSIVE_PTR<RRMultiDimArray<double> > m7 =
        AllocateRRMultiDimArray<double>(AttachRRArray(m7a, 5, false), AllocateRRArray<double>(2560));
    memset(m7->Array->data(), 0, 2560 * sizeof(double));
    uint64_t m5a1[] = {4, 2, 2, 8, 0};
    uint64_t m5b[] = {2, 1, 2, 1, 0};
    uint64_t m5c[] = {2, 2, 1, 1, 10};
    EXPECT_NO_THROW(r->get_m2()->Read(vector<uint64_t>(m5a1, m5a1 + 5), m7, vector<uint64_t>(m5b, m5b + 5),
                                      vector<uint64_t>(m5c, m5c + 5)));
    EXPECT_RRARRAY_EQ(m5->Array, m7->Array);
}

void ServiceTestClient::test_m3()
{
    LFSRSeqGen rng((uint32_t)std::time(0), "multidimarray_test_byte");
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m1 =
        FillMultiDimArray<uint8_t>(rng, boost::assign::list_of(1024)(1024));
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m2 = FillMultiDimArray<uint8_t>(rng, boost::assign::list_of(450)(450));
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m2_1 =
        GetMultiDimArraySub(m2, boost::assign::list_of(20)(25), boost::assign::list_of(200)(200));
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m3 = TestingCopyMultiDimArray(m1);
    SetMultiDimArraySub(m3, boost::assign::list_of(50)(100), m2_1);
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m4 =
        GetMultiDimArraySub(m3, boost::assign::list_of(65)(800), boost::assign::list_of(200)(200));
    uint32_t m5a[] = {512, 512};
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m5 =
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(m5a, 2, false), AllocateEmptyRRArray<uint8_t>(512 * 512));
    SetMultiDimArraySub(m5, boost::assign::list_of(100)(230), m4);

    uint64_t zeros[] = {0, 0};
    vector<uint64_t> vzeros(zeros, zeros + 2);
    EXPECT_NO_THROW(r->get_m3()->Write(vzeros, m1, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));

    int32_t zeros2[] = {0, 0};
    uint32_t tens[] = {1024, 1024};
    RR_INTRUSIVE_PTR<RRArray<int32_t> > vzeros2 = AttachRRArrayCopy(zeros2, 2);
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m1_2 =
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(tens, 2, false), AllocateRRArray<uint8_t>(1024 * 1024));
    EXPECT_NO_THROW(r->get_m3()->Read(vzeros, m1_2, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));
    EXPECT_RRARRAY_EQ(m1->Dims, m1_2->Dims);
    EXPECT_RRARRAY_EQ(m1->Array, m1_2->Array);

    uint64_t m1a[] = {50, 100};
    uint64_t m1b[] = {20, 25};
    uint64_t m1c[] = {200, 200};
    EXPECT_NO_THROW(r->get_m3()->Write(vector<uint64_t>(m1a, m1a + 2), m2, vector<uint64_t>(m1b, m1b + 2),
                                       vector<uint64_t>(m1c, m1c + 2)));

    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m2_2 =
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(tens, 2, false), AllocateRRArray<uint8_t>(1024 * 1024));
    EXPECT_NO_THROW(r->get_m3()->Read(vzeros, m2_2, vzeros, RobotRaconteur::RRArrayToVector<uint64_t>(m1->Dims)));
    EXPECT_RRARRAY_EQ(m2_2->Dims, m3->Dims);
    EXPECT_RRARRAY_EQ(m2_2->Array, m3->Array);

    uint32_t m6a[] = {200, 200};
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m6 =
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(m6a, 2, false), AllocateRRArray<uint8_t>(200 * 200));
    uint64_t m4a[] = {65, 800};
    uint64_t m4b[] = {0, 0};
    uint64_t m4c[] = {200, 200};
    EXPECT_NO_THROW(r->get_m3()->Read(vector<uint64_t>(m4a, m4a + 2), m6, vector<uint64_t>(m4b, m4b + 2),
                                      vector<uint64_t>(m4c, m4c + 2)));
    EXPECT_RRARRAY_EQ(m4->Array, m6->Array);

    uint32_t m7a[] = {512, 512};
    RR_INTRUSIVE_PTR<RRMultiDimArray<uint8_t> > m7 =
        AllocateRRMultiDimArray<uint8_t>(AttachRRArray(m7a, 2, false), AllocateRRArray<uint8_t>(512 * 512));
    memset(m7->Array->data(), 0, 512 * 512);

    uint64_t m5a1[] = {65, 800};
    uint64_t m5b[] = {100, 230};
    uint64_t m5c[] = {200, 200};
    EXPECT_NO_THROW(r->get_m3()->Read(vector<uint64_t>(m5a1, m5a1 + 2), m7, vector<uint64_t>(m5b, m5b + 2),
                                      vector<uint64_t>(m5c, m5c + 2)));
    EXPECT_RRARRAY_EQ(m5->Array, m7->Array);
}

void ServiceTestClient::DisconnectService() { RobotRaconteurNode::s()->DisconnectService(r); }

void ServiceTestClient::TestAuthentication(string url)
{
    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred1 = AllocateEmptyRRMap<string, RRValue>();
    cred1->insert(make_pair("password", stringToRRArray("testpass1")));
    RR_SHARED_PTR<testroot> r1 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser1", cred1));
    r1->func3(2.2, 3.3);
    RobotRaconteurNode::s()->DisconnectService(r1);

    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred2 = AllocateEmptyRRMap<string, RRValue>();
    cred2->insert(make_pair("password", stringToRRArray("testpass2")));
    RR_SHARED_PTR<testroot> r2 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser2", cred2));
    r2->func3(2.2, 3.3);
    RobotRaconteurNode::s()->DisconnectService(r2);

    bool err = false;
    RR_SHARED_PTR<testroot> r3;
    try
    {
        r3 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser2", cred1));
        r3->func3(2.2, 3.3);
    }
    catch (AuthenticationException&)
    // catch (std::exception& e)
    {
        err = true;
        try
        {
            RobotRaconteurNode::s()->DisconnectService(r3);
        }
        catch (std::exception&)
        {}
    }

    EXPECT_TRUE(err);

    RR_SHARED_PTR<testroot> r4;
    try
    {
        r4 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url));
        r4->func3(2.2, 3.3);
    }
    catch (AuthenticationException&)
    {
        err = true;
        try
        {
            RobotRaconteurNode::s()->DisconnectService(r4);
        }
        catch (std::exception&)
        {}
    }

    EXPECT_TRUE(err);
}

void ServiceTestClient::TestObjectLock(string url)
{

    {
        // Unlock all objects before continuing
        RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred6 = AllocateEmptyRRMap<string, RRValue>();
        cred6->insert(make_pair("password", stringToRRArray("superpass1")));
        RR_SHARED_PTR<testroot> r6 =
            rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testsuperuser", cred6));
        RR_SHARED_PTR<sub1> r6_o = r6->get_o1();
        EXPECT_NO_THROW(RobotRaconteurNode::s()->ReleaseObjectLock(r6_o));
    }

    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred1 = AllocateEmptyRRMap<string, RRValue>();
    cred1->insert(make_pair("password", stringToRRArray("testpass1")));
    RR_SHARED_PTR<testroot> r1 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser1", cred1));

    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred2 = AllocateEmptyRRMap<string, RRValue>();
    cred2->insert(make_pair("password", stringToRRArray("testpass2")));
    RR_SHARED_PTR<testroot> r2 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser1", cred1));

    RR_SHARED_PTR<sub1> r1_o;
    RR_SHARED_PTR<sub2> r1_o_o2;
    RR_SHARED_PTR<sub1> r2_o;
    RR_SHARED_PTR<sub2> r2_o_o2;

    RR_SHARED_PTR<testroot> r3;

    RR_SHARED_PTR<sub1> r3_o;
    RR_SHARED_PTR<sub2> r3_o_o2;

    ASSERT_NO_THROW(r1_o = r1->get_o1());
    ASSERT_NO_THROW(r1_o_o2 = r1_o->get_o2_1());
    ASSERT_NO_THROW(r2_o = r2->get_o1());
    ASSERT_NO_THROW(r2_o_o2 = r2_o->get_o2_1());

    ASSERT_NO_THROW(r3 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser2", cred2)));

    ASSERT_NO_THROW(r3_o = r3->get_o1());
    ASSERT_NO_THROW(r3_o_o2 = r3_o->get_o2_1());

    EXPECT_NO_THROW(r1->func3(2.2, 3.3));

    double d1[] = {1.0};
    RR_INTRUSIVE_PTR<RRArray<double> > d = AttachRRArray(d1, 1, false);
    EXPECT_NO_THROW(r1_o->set_d1(d));
    EXPECT_NO_THROW(r1_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r2->func3(2.2, 3.3));
    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(r2_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r3->func3(2.2, 3.3));
    EXPECT_NO_THROW(r3_o->set_d1(d));
    EXPECT_NO_THROW(r3_o_o2->set_data("Hello world"));

    // Lock the object by username
    EXPECT_NO_THROW(RobotRaconteurNode::s()->RequestObjectLock(r1_o, RobotRaconteurObjectLockFlags_USER_LOCK));

    // Check that all users that should access the objects can
    EXPECT_NO_THROW(r1->func3(2.2, 3.3));
    EXPECT_NO_THROW(r1_o->set_d1(d));
    EXPECT_NO_THROW(r1_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r2->func3(2.2, 3.3));
    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(r2_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r3->func3(2.2, 3.3));

    // Check that objects that shouldn't be able to access the objects can't
    EXPECT_THROW(r3_o->set_d1(d), std::exception);
    EXPECT_THROW(r3_o_o2->set_data("Hello world"), std::exception);

    // Unlock and recheck all
    EXPECT_NO_THROW(RobotRaconteurNode::s()->ReleaseObjectLock(r1_o));

    EXPECT_NO_THROW(r1->func3(2.2, 3.3));
    EXPECT_NO_THROW(r1_o->set_d1(d));
    EXPECT_NO_THROW(r1_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r2->func3(2.2, 3.3));
    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(r2_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r3->func3(2.2, 3.3));
    EXPECT_NO_THROW(r3_o->set_d1(d));
    EXPECT_NO_THROW(r3_o_o2->set_data("Hello world"));

    // Relock, test that the lock is active, and then close the connection.  The lock should release.  The
    // second session is closed first, and should not release the lock.
    EXPECT_NO_THROW(RobotRaconteurNode::s()->RequestObjectLock(r1_o, RobotRaconteurObjectLockFlags_USER_LOCK));

    EXPECT_THROW(r3_o->set_d1(d), std::exception);

    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r2));

    // Object still should be locked
    EXPECT_THROW(r3_o->set_d1(d), std::exception);

    // Now close the session and lock should be released
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r1));
    EXPECT_NO_THROW(r3_o->set_d1(d));

    // Reconnect the first two test sessions
    EXPECT_NO_THROW(r1 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser1", cred1)));
    EXPECT_NO_THROW(r2 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testuser1", cred1)));
    EXPECT_NO_THROW(r1_o = r1->get_o1());
    EXPECT_NO_THROW(r1_o_o2 = r1_o->get_o2_1());
    EXPECT_NO_THROW(r2_o = r2->get_o1());
    EXPECT_NO_THROW(r2_o_o2 = r2_o->get_o2_1());

    // Test the exclusive client lock
    EXPECT_NO_THROW(RobotRaconteurNode::s()->RequestObjectLock(r1_o, RobotRaconteurObjectLockFlags_CLIENT_LOCK));
    EXPECT_NO_THROW(r1_o->set_d1(d));
    EXPECT_THROW(r2_o->set_d1(d), std::exception);
    EXPECT_THROW(r3_o->set_d1(d), std::exception);

    // Test the lock override by testsuperpass
    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred5 = AllocateEmptyRRMap<string, RRValue>();
    cred5->insert(make_pair("password", stringToRRArray("superpass1")));
    RR_SHARED_PTR<testroot> r5 =
        rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url, "testsuperuser", cred5));
    RR_SHARED_PTR<sub1> r5_o = r5->get_o1();
    EXPECT_NO_THROW(RobotRaconteurNode::s()->ReleaseObjectLock(r5_o));

    // Make sure the lock is released
    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(r3_o->set_d1(d));

    // Close all connections
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r1));
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r2));
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r3));
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r5));
}

void ServiceTestClient::TestMonitorLock(string url)
{
    // The monitor lock aquires an exclusive sock to a single thread on the client.
    // This lock is for a single thread, and works for all clients and the service if
    // it is checking for monitor locks.

    RR_SHARED_PTR<testroot> r1;
    EXPECT_NO_THROW(r1 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url)));
    EXPECT_NO_THROW(r2 = rr_cast<testroot>(RobotRaconteurNode::s()->ConnectService(url)));

    RR_SHARED_PTR<sub1> r1_o;
    RR_SHARED_PTR<sub2> r1_o_o2;
    EXPECT_NO_THROW(r1_o = r1->get_o1());
    EXPECT_NO_THROW(r1_o_o2 = r1_o->get_o2_1());
    EXPECT_NO_THROW(r2_o = r2->get_o1());
    EXPECT_NO_THROW(r2_o_o2 = r2_o->get_o2_1());

    // Make sure everything works
    EXPECT_NO_THROW(r1->func3(2.2, 3.3));

    double d1[] = {1.0};
    RR_INTRUSIVE_PTR<RRArray<double> > d = AttachRRArrayCopy(d1, 1);
    EXPECT_NO_THROW(r1_o->set_d1(d));
    EXPECT_NO_THROW(r1_o_o2->set_data("Hello world"));

    EXPECT_NO_THROW(r2->func3(2.2, 3.3));
    EXPECT_NO_THROW(r2_o->set_d1(d));
    EXPECT_NO_THROW(r2_o_o2->set_data("Hello world"));

    t2 = false;
    threaderr = true;

    // Request lock
    // RobotRaconteurNode::s()->MonitorEnter(r1_o);

    boost::thread t;

    {
        RobotRaconteurNode::ScopedMonitorLock lock2(r1_o);

        // Start thread and run it
        t = boost::thread(boost::bind(&ServiceTestClient::test_monitor_lock_thread, this));

        t1 = true;
        EXPECT_TRUE(e1.WaitOne(1000));
        boost::this_thread::sleep(boost::posix_time::milliseconds(10));
        EXPECT_NO_THROW(r1->func3(2.2, 3.3));
        EXPECT_NO_THROW(r1_o->set_d1(d));
        EXPECT_FALSE(t2);
        t1 = false;
        // RobotRaconteurNode::s()->MonitorExit(r1_o);
    }

    t.join();
    boost::this_thread::sleep(boost::posix_time::milliseconds(100));

    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r1));
    EXPECT_NO_THROW(RobotRaconteurNode::s()->DisconnectService(r2));

    EXPECT_FALSE(threaderr);
}

void ServiceTestClient::test_monitor_lock_thread()
{
    try
    {
        r2->func3(2.2, 3.3);
        r2_o_o2->set_data("Hello world");
        e1.Set();

        {
            RobotRaconteurNode::ScopedMonitorLock lock3(r2_o);
            // RobotRaconteurNode::s()->MonitorEnter(r2_o);
            if (t1)
                throw std::exception();
            t2 = true;
            double d1[] = {1.0};
            RR_INTRUSIVE_PTR<RRArray<double> > d = AttachRRArrayCopy(d1, 1);
            r2_o->set_d1(d);
        }
        // RobotRaconteurNode::s()->MonitorExit(r2_o);
        threaderr = false;
    }
    catch (std::exception&)
    {
        threaderr = true;
    }
}

void ServiceTestClient::TestAsync_err(RR_SHARED_PTR<RobotRaconteurException> exp)
{
    boost::mutex::scoped_lock lock(async_err_lock);
    async_err = exp;
    async_wait.Set();
}

void ServiceTestClient::TestAsync(string url)
{
    RR_INTRUSIVE_PTR<RRMap<string, RRValue> > cred1 = AllocateEmptyRRMap<string, RRValue>();
    cred1->insert(make_pair("password", stringToRRArray("testpass1")));
    ASSERT_NO_THROW(RobotRaconteurNode::s()->AsyncConnectService(
        url, "testuser1", cred1, RR_NULL_FN, "",
        boost::bind(&ServiceTestClient::TestAsync1, this, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2))));

    if (!async_wait.WaitOne(1000))
    {
        throw std::runtime_error("Timeout waiting for result");
    }
    boost::mutex::scoped_lock lock(async_err_lock);
    if (async_err)
    {
        throw *async_err;
    }
}

void ServiceTestClient::TestAsync1(RR_SHARED_PTR<RRObject> r, RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(RR_SHARED_PTR<async_testroot> r1 = rr_cast<async_testroot>(r); r1->async_get_d2(
        boost::bind(&ServiceTestClient::TestAsync2, this, r1, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2))););
}

void ServiceTestClient::TestAsync2(RR_SHARED_PTR<async_testroot> r, RR_INTRUSIVE_PTR<RRArray<double> > ret,
                                   RR_SHARED_PTR<RobotRaconteurException> exp)
{
    if (exp)
    {
        TestAsync_err(exp);
        return;
    }
    try
    {
        double d2_b[] = {
            1.374233e+19,  2.424327e-04,  -1.615609e-02, 3.342963e-21,  -4.308134e+14, -1.783430e-07, 2.214302e+18,
            -1.091018e+17, 3.279396e-20,  2.454183e-01,  1.459922e+07,  -3.494941e+16, -7.949200e-21, 1.720101e+17,
            -1.041015e+16, 1.453541e+05,  1.125846e+06,  1.894394e+07,  1.153038e-17,  -3.283589e+06, 2.253268e-10,
            -3.897051e+06, 1.362011e+05,  5.501697e-19,  -4.854610e+01, -1.582705e-05, 7.622313e+04,  2.104642e+08,
            -1.294512e-06, -1.426230e-19, -4.319619e-15, 9.837716e+03,  -4.949316e-01, -2.173576e+02, 2.730509e-19,
            -2.123803e+05, 1.652596e-17,  -2.066863e-09, 3.856560e-08,  1.379652e+18,  -2.119906e+16, 4.860679e-05,
            -1.681801e-10, -1.569650e-15, 3.984306e-21,  3.283336e+08,  -9.222510e-16, -3.579521e-02, 1.279363e-05,
            3.920153e-12,  4.737275e-15,  -4.427587e+06, -3.826670e-14, 2.492484e-04,  4.996082e+09,  4.643228e-11,
            2.809952e-17,  -2.224883e-13, -4.442602e+18, 4.422736e+11,  4.969282e-18,  4.937908e-15,  6.973867e-22,
            1.908796e-19,  4.812115e-08,  1.753516e-02,  -3.684764e+02, 1.557482e-17,  -1.176997e-11, 1.772798e-05,
            4.877622e-16,  1.107926e+11,  4.097985e-14,  2.714049e-18,  3.198732e+15,  -1.052497e-01, -5.003982e+07,
            -1.538353e-04, 3.045308e+17,  1.176208e-18,  1.268710e-10,  -1.269719e-05, -2.989599e+00, -3.721343e-11,
            -1.444196e-10, -2.030635e+04, 2.070258e+16,  -3.001278e-14, 1.116018e+14,  4.999239e+15,  4.286177e-21,
            -2.972550e+10, 3.549075e-20,  -2.874186e-06, 2.994430e+09,  2.978356e+10,  -2.364977e+07, 2.807278e-01,
            -3.279567e-10, 4.567428e+05,  1.612242e+07,  4.102315e+05,  -1.069501e-20, 2.887812e+10,  4.384194e-09,
            -2.936771e-11, -4.164448e+07, 3.391389e+04,  -3.923673e+17, -2.735518e-22, -2.019257e-01, 3.014806e+15,
            -3.885050e-15, -2.806241e-20, 3.077066e+18,  -1.574438e+14, -3.131588e+19, 4.812541e+03,  4.435881e+16,
            -3.843380e+02, -7.522165e+03, -3.668055e-21, 2.603478e-08,  2.928775e+08,  2.892123e+00,  -1.594119e+04,
            -4.817379e-01, -2.121948e+03, -8.872132e-09, -3.909318e-06, -3.849648e-14, -4.554589e+18, 4.410297e-15,
            -2.976295e-04, -2.298802e+10, 4.981337e-07,  5.364781e-12,  1.536953e+07,  -4.082889e-07, 1.670759e-21,
            4.009147e-13,  -4.691543e-18, -2.597887e-13, 2.368696e+18,  -2.585884e-07, -5.209726e-03, -2.568300e+06,
            2.184692e-20,  -1.799204e+16, 1.397292e+04,  4.277966e+13,  -4.072388e+09, -2.324749e+16, -4.717399e+10,
            -2.853124e-05, -3.664750e+11, -3.864796e-08, 3.265198e+07,  -3.309827e+19, 3.222296e+03,  2.366113e-19,
            -3.425143e+14, 1.627821e-08,  4.987622e+00,  -1.402489e-17, -1.303904e+15, -2.042850e+17, -1.399340e+09,
            -3.560871e+05, -4.251240e-21, -7.806581e-10, 1.723498e+00,  -2.030115e+08, 4.595621e-19,  1.174387e-10,
            3.474174e+14,  -4.159866e+03, -1.833464e-19, -3.650925e+05, 3.757361e-03,  -1.854280e-10, -1.856982e-13,
            1.685338e+08,  4.051670e-11,  4.095232e+03,  -2.956025e-16, 4.986423e-05,  4.941458e+10,  4.145946e+11,
            3.402975e+14,  -1.954363e+11, -2.274907e+10, -3.162121e-17, -5.027950e-07, 4.135173e-02,  -3.777913e-04,
            -4.898637e+15, 2.354747e-02,  -6.884549e+13, -1.896920e-05, -1.914414e+15, -1.196744e-19, -4.692974e-01,
            8.586675e-10,  -2.204766e-17, -3.586447e-14, 1.751276e+17,  -2.546189e-05, -2.248796e+03, -9.445830e+02,
            1.150138e+03,  4.586691e+11,  -2.582686e-15, -2.795788e+12, -3.409768e+07, -2.172186e-03, -1.457882e+06,
            -4.153022e+13, -4.255977e-08, 3.216237e-07,  4.935803e+02,  -4.248965e-16, 1.740357e+07,  4.635370e+19,
            -4.099930e-14, 2.758885e-16,  -4.714106e-05, -4.556226e-20, -4.290894e-19, 1.174284e-09,  -1.443257e+16,
            -2.279471e-08, -3.030819e-16, 1.535128e+18,  -3.248271e-07, 3.079855e-21,  -3.056403e-02, -1.368113e-12,
            4.004190e-10,  4.955150e+07,  -2.494283e-16, 2.186037e+05,  -1.232946e+03, 5.586112e-05,  -2.288144e+17,
            2.515602e-19,  -4.064132e+08, -3.217400e-02, -2.620215e+07, 2.283421e-14,  -1.130075e+08, 3.304955e-03,
            1.352402e+01,  6.255755e-03,  -3.913649e-08, 5.474984e+01,  -4.712294e-08, 3.548418e-16,  1.276896e+12,
            2.007320e-08,  3.025617e+04,  -2.544836e+14, -2.087825e+17, -3.285556e-09, 2.605304e+07,  -1.876210e+07,
            3.734943e-10,  -3.862726e-15, -4.227362e-05, 1.267773e+14,  -1.706991e-05, 3.737441e+10,  2.641527e+01,
            4.439891e+10,  -1.444933e-05, -2.190034e-12, 8.059924e-18,  -1.324313e+18, -1.420214e-10, 3.940158e-20,
            3.943349e-02,  -2.685925e+19, 4.334133e-05,  3.171371e-21,  2.094486e+12,  1.331741e+03,  1.205892e-02,
            1.791416e+04,  3.899239e+10,  6.581991e+06,  -3.860368e+11, -3.853916e-02, 1.314566e+09,  3.923126e+03,
            -3.509905e+13, -4.332430e+06, -1.713419e+01, -1.244104e-14, -5.529613e+01, 6.630349e+06,  1.053668e+10,
            3.312332e-05,  -1.252220e+08, 3.997107e-07,  1.847068e-13,  -2.393157e-11, -2.083719e-10, -4.927155e+11,
            2.666499e-15,  4.087292e-10,  4.082567e-10,  -2.017655e+07, 9.108015e+15,  -4.199693e-15, -4.969705e-17,
            1.769881e-02,  1.745504e+00,  2.200377e-16,  -4.404838e-06, -1.317122e-15, 7.210560e+08,  1.282439e-18,
            -3.204957e-06, -1.624277e+05, 4.570975e-22,  1.261776e+04,  4.416193e+12,  -4.343457e-18, 4.095420e-14,
            4.951026e-09,  2.261753e-15,  4.125062e+05,  -4.448849e+11, -3.184924e+06, -2.050956e+05, -9.895539e+09,
            4.541548e+11,  -4.230580e+11, -4.268059e-15, -4.393836e+09, -2.514832e-08, 3.322394e-04,  2.597384e-18,
            1.316619e-11,  -2.250081e+16, 2.179579e-10,  -1.838295e+04, -1.995626e-17, -4.656110e+17, 3.481814e-07,
            -2.859273e-11, -2.011768e-06, -1.809342e-17, -3.242126e+10, -1.873723e+08, -2.833009e-12, -3.758282e+12,
            2.970198e+15,  -2.667738e-01, -3.689173e+11, 1.008362e-10,  -1.526867e-20, -1.439753e+06, -6.154602e+16,
            4.165816e+00,  -1.597823e-09, -1.862803e+14, -2.222766e+15, -2.892587e+17, -4.230426e-14, 2.999121e-21,
            1.642245e+00,  1.590694e-14,  -4.469755e-06, 2.700655e+12,  -1.822443e-02, -4.889338e-16, -3.174990e-11,
            4.146024e-03,  1.313280e+01,  3.235142e+15,  3.500547e+00,  -4.413708e+03, 1.485548e+16,  -1.660821e-11,
            -4.334510e-22, -1.209739e+04, 1.149570e+12,  -4.537849e+00, -3.628402e-16, 2.748853e-12,  -4.818907e-21};
        EXPECT_RRARRAY_EQ(AttachRRArray(d2_b, 392, false), ret);
        double d2_a[] = {
            8.805544e-12,  3.735066e+12,  3.491919e+17,  4.979833e+12,  -4.042302e+00, 2.927731e-12,  5.945355e+11,
            -3.965351e+06, 4.866934e-14,  1.314597e+04,  -2.059923e-11, -5.447989e-20, 1.267732e-21,  -2.603983e+10,
            2.417961e+03,  3.515469e-16,  1.731329e-01,  -2.854408e-04, 2.908090e-06,  3.354746e+08,  9.405914e+05,
            -3.665276e-01, -2.036897e+02, 3.489765e-01,  -3.207702e+11, -2.105708e+18, -1.485891e+13, -7.059704e+04,
            3.528381e+11,  4.586056e+02,  -8.107050e-16, -1.007106e+09, 2.964453e+05,  -3.628810e+05, -2.816870e-14,
            5.665387e+09,  8.518736e+11,  -1.179981e+12, -1.506569e-21, 1.113076e-06,  -4.782847e+06, 8.906463e+17,
            2.729604e+03,  -3.430604e+16, 2.626956e-07,  1.543395e+15,  3.407777e-21,  1.231519e+06,  -4.808410e+16,
            2.649811e+10,  2.546524e+01,  -3.533472e-13, -3.732759e+04, 1.951505e-20,  9.338953e-21,  -1.627672e-04,
            1.807084e-19,  -4.489206e-17, -2.654284e+08, -2.136947e+16, -3.690031e+09, 3.372245e-14,  4.946361e-11,
            -1.330965e-01, 2.479789e-17,  2.750331e-18,  -4.301452e-03, 3.895091e+19,  2.515863e+13,  6.879298e+12,
            -2.925884e-15, -2.826248e+00, -4.864526e-06, 2.614765e+00,  4.488816e-19,  2.231337e+15,  -7.004595e+07,
            2.506835e-08,  -2.187450e-02, -2.220025e-07, 1.688346e+02,  8.125250e-07,  -4.819391e+10, -1.643306e-14,
            -4.768222e-18, -4.472162e-16, 2.487563e-01,  -3.924904e-15, -1.186331e+06, 2.397369e+01,  -3.137448e-02,
            1.016507e+06,  2.584749e-16,  8.212180e-08,  1.631561e-12,  -4.927066e-08, 1.448920e-14,  -4.371505e+03,
            2.050871e-21,  2.523287e+01,  7.778552e-05,  -4.437786e+18, -1.118552e-07, -3.543717e-09, -5.327587e-07,
            -1.083197e-17, 2.578295e-10,  -4.952430e-12, -3.008597e-13, 3.010829e+01,  -6.109332e+09, -2.428341e-03,
            9.399191e-01,  -4.827230e-06, 1.013860e+10,  -2.870341e-20, 4.281756e+11,  1.043519e-09,  2.378027e+06,
            2.605309e+09,  -4.939600e-04, -2.193966e+08, 4.022755e-03,  2.668705e-09,  -1.087393e-18, 1.927676e-12,
            -1.694835e+10, 3.554035e-03,  -1.299796e+01, -1.692862e+07, 2.818156e+07,  -2.606821e-13, 1.629588e-15,
            -7.069991e-16, 1.205863e-19,  2.491209e-17,  -3.757951e+04, 3.110266e-04,  -4.339472e+11, -3.172428e+02,
            1.579905e+09,  2.859499e-01,  4.241852e-06,  2.043341e-09,  2.922865e-16,  -2.580974e+01, -3.147566e-02,
            1.160590e+03,  -2.238096e+01, -1.984601e-13, 2.636096e-03,  8.422872e-04,  2.026040e-16,  -3.822500e+01,
            -2.190513e-18, 3.229839e-11,  -2.958164e+06, -8.354021e+11, 3.625367e+08,  -4.558085e-01, 1.274325e+04,
            -2.492750e+05, 3.739269e+18,  -3.985407e-03, 3.575816e-13,  1.376847e+06,  -6.682659e-20, -9.200014e+08,
            -2.278973e+10, -3.555184e-04, 3.821512e-10,  5.944167e+07,  -2.576511e-15, 1.232459e+02,  -3.187831e+02,
            -4.882568e+12, -1.670486e+05, -2.339878e-20, -4.985496e-16, -2.937093e+17, 8.981723e-06,  -5.460686e-04,
            1.090528e-11,  -4.321598e+17, -3.577227e-08, 2.880194e+01,  -4.277921e+00, -4.145678e-02, 4.930810e+08,
            -4.525745e-21, 4.648764e+07,  -2.564920e+16, 1.075546e+01,  3.777591e-18,  1.419816e-08,  1.419490e+10,
            1.479453e-19,  -4.933130e+13, 4.580471e+15,  -3.160785e+02, -2.885209e+06, 2.384424e-03,  1.030777e-12,
            2.652784e+04,  4.435144e+10,  3.102484e+17,  4.725294e+11,  -3.817788e-04, 4.074841e-01,  -7.248042e-13,
            -4.502531e-08, 2.203521e+01,  -4.457124e+01, -2.961745e+06, -3.237080e+14, -3.482497e-19, 1.534088e+05,
            4.759060e-14,  2.333791e+04,  -4.002051e-03, 3.278553e-06,  -2.307217e+13, -2.999411e+19, -9.804484e+02,
            -1.793367e+01, 3.111735e+07,  -4.457329e+10, -2.067659e-13, -5.927573e+03, 6.979879e+10,  3.556110e-06,
            -3.513094e-13, 1.128057e+19,  4.199038e+13,  7.553080e-20,  4.380028e-11,  -2.502103e-19, 5.943049e+15,
            -1.266134e-10, 4.825578e-09,  -2.778134e-16, 1.881866e-10,  -3.677556e+08, -2.166345e-10, 3.919158e+05,
            2.778912e-07,  1.822489e-05,  1.513496e-01,  9.327925e+05,  -4.050132e-14, 3.311913e+01,  9.290544e+15,
            1.302267e+03,  -1.252080e+17, -4.208811e-04, -3.225464e+16, 2.093787e+16,  -3.352116e+07, 4.797665e+15,
            -1.539672e-17, 4.835159e+04,  2.446236e-07,  2.355328e-17,  2.044244e-12,  3.210415e-11,  -1.322741e+16,
            5.538184e-14,  -4.612046e-05, 4.758939e+15,  -2.038208e-10, -2.451148e+18, -2.699711e-19, -2.019804e-09,
            5.631634e-13,  -2.288031e+05, -3.211488e+12, 7.511869e+13,  -3.209453e-09, 3.806128e-18,  4.025006e-14,
            -1.700945e-10, 4.136280e-13,  4.517870e-04,  2.739233e+11,  -3.736057e-03, 2.255379e-20,  3.122584e-16,
            3.192660e-18,  4.765755e-09,  2.396494e-13,  1.625326e+02,  -3.413821e-18, 3.627586e+10,  8.708108e+07,
            2.244241e-09,  3.718827e-02,  1.803394e-18,  4.377806e-04,  1.593155e-04,  -2.886859e+19, 2.446955e-06,
            4.714172e-07,  -1.444181e+14, 5.921228e-22,  -3.968436e+05, 2.081487e+08,  4.200042e+18,  -1.334353e-20,
            1.637913e+12,  -7.203262e+03, 3.510359e+09,  5.945107e-08,  2.798793e-07,  1.819020e+17,  -1.331690e+02,
            -2.714485e+18, -2.344350e-18, -1.313232e-20, -6.739364e-22, 1.025007e-02,  1.186976e+07,  -1.412268e+09,
            -6.194861e-18, -4.523625e-03, -4.504270e-06, 2.158726e-21,  -8.330465e-17, 4.566938e+11,  6.677905e-05,
            -2.312717e-13, 5.325983e+16,  -1.075392e-04, 1.140532e-13,  2.606136e-11,  -2.815243e+16, -3.550714e-16,
            -1.033372e+05, -1.183041e+03, -7.872171e-21, -4.362058e-07, -3.181126e-07, -2.676671e+18, -2.674920e-15,
            -3.991169e-16, -4.401799e+07, -2.826847e-10, -2.033266e-20, -5.669789e-11, 3.711339e+05,  -1.194584e-17,
            -3.310173e+10, -1.743331e-15, -2.288755e+15, 8.610375e+06,  4.796813e+07,  -1.465344e+07, -4.074823e-12,
            2.089962e-21,  -4.171761e-18, -4.682371e+18, 4.030447e+08,  4.679856e-07,  -2.662732e+15, 2.551805e-21,
            2.482089e+05,  -2.310281e-10, 3.533837e-08,  1.829437e-07,  3.074466e-06,  -2.889997e-12, -4.203806e+01,
            1.598374e-21,  -1.300526e-05, 2.921093e+14,  -8.847920e+14, 3.788583e-04,  -4.538453e+19, -2.734893e+07,
            1.351281e-04,  1.128593e-01,  3.868545e+13,  -1.200438e+18, -2.641822e+10, -4.493835e-16, -6.291094e-13,
            2.534337e-08,  -4.063653e-03, 3.200675e-02,  2.243642e+08,  5.170843e-08,  8.984841e-14,  2.228243e-01,
            -6.770559e-09, 3.513375e-16,  -2.512038e-14, 3.421696e+04,  -4.514522e+01, -1.062799e-20, 2.853168e-19,
            8.503515e-21,  -1.664790e-03, -2.515606e-18, 1.237958e-21,  -8.059224e-20, 4.386086e+00,  5.301466e+17,
            4.388106e-12,  -3.432129e+00, 2.189230e+18,  -1.806446e-02, 3.266789e-18,  3.355664e-13,  -1.206966e-21,
            -4.813560e-02, -1.352049e+18, 1.257234e-07,  2.511470e-09,  -2.512775e-01, 3.613773e-10,  -9.065202e+16,
            -1.777852e+18, 1.444606e-01,  -2.857379e+00, -1.912993e+00, 3.436817e-09,  -1.749039e+14, 2.215154e-18,
            3.384923e+18,  -4.513038e-09, 4.814904e+05,  3.730911e+15,  1.861706e+12,  3.378290e-03,  2.851468e-06,
            -1.577518e-04, -4.122504e-12, -2.743002e+03, 8.512568e-02,  -1.333039e-09, -4.899609e-17, -1.782085e-11,
            2.552482e-02,  4.200193e+10,  -4.298147e+03, -1.923210e-10, -1.208889e+01, 4.606772e-21,  -3.331241e+10,
            -3.704566e-16, -3.733178e-20, -4.950049e+16, 3.184384e+15,  -4.107375e-06, 1.801875e+09,  9.632951e-16,
            7.172728e-10,  2.324621e+07,  2.892586e+15,  -1.582511e-17, -4.119044e-13, -1.248361e+09, 1.531907e+08,
            -1.795628e-19, -1.735919e-17, -4.646689e-07, -2.779304e-11, 8.048984e-10,  3.536087e-02,  -6.494880e+18,
            2.714073e+06,  3.374557e+18,  3.621468e-06,  2.742652e-07,  2.551176e+03,  -4.420578e+18, -4.370624e-08,
            -4.507765e-11, 4.193746e-20,  1.206645e+13,  -3.750231e+03, 4.390893e+08,  -9.756466e+11, 3.392778e-06,
            -3.453465e+01, -1.406102e+11, -3.673526e-15, 1.417082e-03,  1.499926e+16,  -4.471032e-17, -2.657920e+16,
            4.792261e+09,  -3.212735e+17, -3.372737e-05, -4.730048e+01, 3.365478e+07,  2.835695e+13,  -3.242022e-07,
            3.640288e+11,  1.862055e-08,  -4.121250e-19, -3.891100e-02, -4.367058e-15, 1.364067e-17,  -4.575429e-12,
            3.621347e-07,  1.506864e+11,  3.715065e+18,  -1.773352e+08, -3.502359e+07, -2.326890e-04, 2.948814e-17,
            -2.438988e+14, -2.994787e+04, -3.755515e+12, 2.708013e-13,  3.281046e-01,  -3.710727e+12, -8.380304e+14,
            1.062737e-05,  2.385939e+16,  -4.383210e-20, -3.779417e+03, 3.080324e-03,  3.810188e+16,  3.058415e+00,
            -2.484879e-21, -1.951684e+01, 6.979033e-10,  -3.866994e+06, 4.278936e-19,  9.365131e+10,  -3.685205e+01,
            -2.678752e-16, 2.011434e-19,  1.884072e+08,  -1.300910e+04, 2.414058e-09,  -4.675979e+11, 3.583361e-19,
            -4.499438e+18, 1.641999e-21,  -2.686795e-10, 6.136688e-20,  -3.793690e+16, 4.944562e-20,  -3.490443e-03,
            3.080547e+02,  2.041413e-06,  2.021979e+03,  2.314233e-06,  1.564131e-01,  -8.712542e+17, 7.569081e+16,
            -1.056907e+17, 2.095024e-14,  -2.487621e+17, -3.490381e+19, -6.944641e-01, -2.892354e-08, -3.597351e+12,
            -1.985424e+06, -2.348859e+09, -1.657051e+01, -3.358823e+14, 3.219974e-16,  -4.819092e-13, -2.905178e-11,
            8.257664e+04,  -4.092466e-15, -3.464711e-13, -3.956400e-14, -2.548275e-08, -8.917872e-21, 7.387291e+13,
            2.300996e+16,  -4.870764e+18, -9.909380e-03, 1.260429e-08,  -3.409396e-12, 1.003848e+02,  -4.883178e-02,
            -3.125474e-14, 1.005294e+11,  -4.736012e+09, -1.647544e-09, -3.491431e-03, 4.619061e+07,  -4.547601e-09,
            -3.788900e-02, -2.648380e-17, 4.601877e-16,  1.754357e+13,  4.325616e+12,  1.860822e+03,  4.080727e+15,
            -4.573470e-14, -1.293538e+16, 2.811449e+05,  4.032351e+06,  4.274005e+04,  3.454035e-21,  4.933014e+09,
            -3.712562e+08, 3.158678e+06,  -1.636782e+11, -2.884298e-18, -3.685740e-17, 1.027472e-07,  -3.765173e-12,
            2.740894e-17,  2.634880e+02,  -4.334010e+00, -3.708285e-14, -3.858731e+16, -3.956687e+13, -4.064064e-12,
            2.558646e-05,  4.459143e+03,  -9.661948e+03, -1.994335e+16, 1.202714e-17,  -3.782707e-17, 9.099692e-04,
            -1.864561e+09, 3.493877e-08,  4.288188e-01,  1.767126e-14,  -6.779451e-22, -1.977471e-09, -3.536454e+06,
            -7.319495e-04, 2.004028e-16,  -3.181521e-17, 3.336202e+14,  -2.752423e+07, 3.390953e+01,  4.199625e-15,
            2.883232e-12,  3.122912e-06,  7.324619e-19,  3.092709e-02,  -2.758364e-15, -2.489492e+12, -1.622009e-08,
            2.371204e+06,  -1.582081e+08, -6.382371e-17};
        r->async_set_d2(AttachRRArrayCopy(d2_a, 647),
                        boost::bind(&ServiceTestClient::TestAsync3, this, r, RR_BOOST_PLACEHOLDERS(_1)));
    }
    catch (std::exception&)
    {
        TestAsync_err(RR_MAKE_SHARED<UnknownException>("ERR", "Err occurred"));
    }
}

void ServiceTestClient::TestAsync3(RR_SHARED_PTR<async_testroot> r, RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(r->async_func1(boost::bind(&ServiceTestClient::TestAsync4, this, r, RR_BOOST_PLACEHOLDERS(_1))););
}

void ServiceTestClient::TestAsync4(RR_SHARED_PTR<async_testroot> r, RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(r->async_func3(
        2, 3.45,
        boost::bind(&ServiceTestClient::TestAsync5, this, r, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2))););
}

void ServiceTestClient::TestAsync5(RR_SHARED_PTR<async_testroot> r, double ret,
                                   RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(if (ret != 5.45) throw std::runtime_error(""); r->async_func_errtest(
        boost::bind(&ServiceTestClient::TestAsync6, this, r, RR_BOOST_PLACEHOLDERS(_1))););
}

void ServiceTestClient::TestAsync6(RR_SHARED_PTR<async_testroot> r, RR_SHARED_PTR<RobotRaconteurException> exp)
{
    try
    {
        if (!exp)
            throw std::runtime_error("");
        r->async_get_o1(
            boost::bind(&ServiceTestClient::TestAsync7, this, r, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2)));
    }
    catch (std::exception&)
    {
        TestAsync_err(RR_MAKE_SHARED<UnknownException>("ERR", "Err occurred"));
    }
}

void ServiceTestClient::TestAsync7(RR_SHARED_PTR<async_testroot> r, RR_SHARED_PTR<sub1> o1,
                                   RR_SHARED_PTR<RobotRaconteurException> exp)
{
    // TODO: fix this test
    ASYNC_TEST_CALL(
        // if (!o1) throw std::runtime_error("");
        // o1->get_d1();

        RR_SHARED_PTR<testroot> r1 = rr_cast<testroot>(r);
        r1->get_p1()->AsyncConnect(-1, boost::bind(&ServiceTestClient::TestAsync8, this, r1, RR_BOOST_PLACEHOLDERS(_1),
                                                   RR_BOOST_PLACEHOLDERS(_2)));

    );
}

void ServiceTestClient::TestAsync8(RR_SHARED_PTR<testroot> r,
                                   RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > e1,
                                   RR_SHARED_PTR<RobotRaconteurException> exp)
{
    double d1[] = {1, 2, 3, 4};
    ASYNC_TEST_CALL(

        e1->AsyncSendPacket(AttachRRArrayCopy(d1, 4),
                            boost::bind(&ServiceTestClient::TestAsync9, this, r, e1, RR_BOOST_PLACEHOLDERS(_1),
                                        RR_BOOST_PLACEHOLDERS(_2)));)
}

void ServiceTestClient::TestAsync9(RR_SHARED_PTR<testroot> r,
                                   RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > e1, uint32_t pnum,
                                   RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(
        e1->AsyncClose(boost::bind(&ServiceTestClient::TestAsync10, this, r, e1, RR_BOOST_PLACEHOLDERS(_1))););
}

void ServiceTestClient::TestAsync10(RR_SHARED_PTR<testroot> r,
                                    RR_SHARED_PTR<PipeEndpoint<RR_INTRUSIVE_PTR<RRArray<double> > > > e1,
                                    RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(r->get_w1()->AsyncConnect(
        boost::bind(&ServiceTestClient::TestAsync11, this, r, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2))));
}

void ServiceTestClient::TestAsync11(RR_SHARED_PTR<testroot> r,
                                    RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRArray<double> > > > w1,
                                    RR_SHARED_PTR<RobotRaconteurException> exp)
{
    double d0[] = {0.0};
    ASYNC_TEST_CALL(w1->SetOutValue(AttachRRArrayCopy(d0, 1)); w1->AsyncClose(
        boost::bind(&ServiceTestClient::TestAsync12, this, r, w1, RR_BOOST_PLACEHOLDERS(_1))););
}

void ServiceTestClient::TestAsync12(RR_SHARED_PTR<testroot> r,
                                    RR_SHARED_PTR<WireConnection<RR_INTRUSIVE_PTR<RRArray<double> > > > w1,
                                    RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(RobotRaconteurNode::s()->AsyncRequestObjectLock(
        r, RobotRaconteurObjectLockFlags_CLIENT_LOCK,
        boost::bind(&ServiceTestClient::TestAsync13, this, r, RR_BOOST_PLACEHOLDERS(_1), RR_BOOST_PLACEHOLDERS(_2))););
}

void ServiceTestClient::TestAsync13(RR_SHARED_PTR<testroot> r, RR_SHARED_PTR<std::string> res,
                                    RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(if (!res) throw std::runtime_error(""); if (*res != "OK") throw std::runtime_error("");
                    RobotRaconteurNode::s()->AsyncReleaseObjectLock(r, boost::bind(&ServiceTestClient::TestAsync14,
                                                                                   this, r, RR_BOOST_PLACEHOLDERS(_1),
                                                                                   RR_BOOST_PLACEHOLDERS(_2))););
}

void ServiceTestClient::TestAsync14(RR_SHARED_PTR<testroot> r, RR_SHARED_PTR<std::string> res,
                                    RR_SHARED_PTR<RobotRaconteurException> exp)
{
    ASYNC_TEST_CALL(if (!res) throw std::runtime_error(""); if (*res != "OK") throw std::runtime_error("");
                    RobotRaconteurNode::s()->AsyncDisconnectService(
                        rr_cast<RRObject>(r), boost::bind(&ServiceTestClient::TestAsync15, this)););
}

void ServiceTestClient::TestAsync15() { async_wait.Set(); }

void ServiceTestClient::RunSingleThreadTest(string url, RR_BOOST_ASIO_IO_CONTEXT& io_context)
{
    IOContextThreadPool_AsyncResultAdapter<RR_SHARED_PTR<RRObject> > connect_res(io_context);
    ASSERT_NO_THROW(RobotRaconteurNode::s()->AsyncConnectService(
        url, "", RR_INTRUSIVE_PTR<RRMap<std::string, RRValue> >(), RR_NULL_FN, "", connect_res, 5000));
    RR_SHARED_PTR<RRObject> c1 = connect_res.GetResult();
    RR_SHARED_PTR<async_testroot> c = rr_cast<async_testroot>(c1);

    IOContextThreadPool_AsyncResultAdapter<RR_INTRUSIVE_PTR<RRArray<double> > > get_d2(io_context);
    ASSERT_NO_THROW(c->async_get_d2(get_d2));
    double d2_b[] = {
        1.374233e+19,  2.424327e-04,  -1.615609e-02, 3.342963e-21,  -4.308134e+14, -1.783430e-07, 2.214302e+18,
        -1.091018e+17, 3.279396e-20,  2.454183e-01,  1.459922e+07,  -3.494941e+16, -7.949200e-21, 1.720101e+17,
        -1.041015e+16, 1.453541e+05,  1.125846e+06,  1.894394e+07,  1.153038e-17,  -3.283589e+06, 2.253268e-10,
        -3.897051e+06, 1.362011e+05,  5.501697e-19,  -4.854610e+01, -1.582705e-05, 7.622313e+04,  2.104642e+08,
        -1.294512e-06, -1.426230e-19, -4.319619e-15, 9.837716e+03,  -4.949316e-01, -2.173576e+02, 2.730509e-19,
        -2.123803e+05, 1.652596e-17,  -2.066863e-09, 3.856560e-08,  1.379652e+18,  -2.119906e+16, 4.860679e-05,
        -1.681801e-10, -1.569650e-15, 3.984306e-21,  3.283336e+08,  -9.222510e-16, -3.579521e-02, 1.279363e-05,
        3.920153e-12,  4.737275e-15,  -4.427587e+06, -3.826670e-14, 2.492484e-04,  4.996082e+09,  4.643228e-11,
        2.809952e-17,  -2.224883e-13, -4.442602e+18, 4.422736e+11,  4.969282e-18,  4.937908e-15,  6.973867e-22,
        1.908796e-19,  4.812115e-08,  1.753516e-02,  -3.684764e+02, 1.557482e-17,  -1.176997e-11, 1.772798e-05,
        4.877622e-16,  1.107926e+11,  4.097985e-14,  2.714049e-18,  3.198732e+15,  -1.052497e-01, -5.003982e+07,
        -1.538353e-04, 3.045308e+17,  1.176208e-18,  1.268710e-10,  -1.269719e-05, -2.989599e+00, -3.721343e-11,
        -1.444196e-10, -2.030635e+04, 2.070258e+16,  -3.001278e-14, 1.116018e+14,  4.999239e+15,  4.286177e-21,
        -2.972550e+10, 3.549075e-20,  -2.874186e-06, 2.994430e+09,  2.978356e+10,  -2.364977e+07, 2.807278e-01,
        -3.279567e-10, 4.567428e+05,  1.612242e+07,  4.102315e+05,  -1.069501e-20, 2.887812e+10,  4.384194e-09,
        -2.936771e-11, -4.164448e+07, 3.391389e+04,  -3.923673e+17, -2.735518e-22, -2.019257e-01, 3.014806e+15,
        -3.885050e-15, -2.806241e-20, 3.077066e+18,  -1.574438e+14, -3.131588e+19, 4.812541e+03,  4.435881e+16,
        -3.843380e+02, -7.522165e+03, -3.668055e-21, 2.603478e-08,  2.928775e+08,  2.892123e+00,  -1.594119e+04,
        -4.817379e-01, -2.121948e+03, -8.872132e-09, -3.909318e-06, -3.849648e-14, -4.554589e+18, 4.410297e-15,
        -2.976295e-04, -2.298802e+10, 4.981337e-07,  5.364781e-12,  1.536953e+07,  -4.082889e-07, 1.670759e-21,
        4.009147e-13,  -4.691543e-18, -2.597887e-13, 2.368696e+18,  -2.585884e-07, -5.209726e-03, -2.568300e+06,
        2.184692e-20,  -1.799204e+16, 1.397292e+04,  4.277966e+13,  -4.072388e+09, -2.324749e+16, -4.717399e+10,
        -2.853124e-05, -3.664750e+11, -3.864796e-08, 3.265198e+07,  -3.309827e+19, 3.222296e+03,  2.366113e-19,
        -3.425143e+14, 1.627821e-08,  4.987622e+00,  -1.402489e-17, -1.303904e+15, -2.042850e+17, -1.399340e+09,
        -3.560871e+05, -4.251240e-21, -7.806581e-10, 1.723498e+00,  -2.030115e+08, 4.595621e-19,  1.174387e-10,
        3.474174e+14,  -4.159866e+03, -1.833464e-19, -3.650925e+05, 3.757361e-03,  -1.854280e-10, -1.856982e-13,
        1.685338e+08,  4.051670e-11,  4.095232e+03,  -2.956025e-16, 4.986423e-05,  4.941458e+10,  4.145946e+11,
        3.402975e+14,  -1.954363e+11, -2.274907e+10, -3.162121e-17, -5.027950e-07, 4.135173e-02,  -3.777913e-04,
        -4.898637e+15, 2.354747e-02,  -6.884549e+13, -1.896920e-05, -1.914414e+15, -1.196744e-19, -4.692974e-01,
        8.586675e-10,  -2.204766e-17, -3.586447e-14, 1.751276e+17,  -2.546189e-05, -2.248796e+03, -9.445830e+02,
        1.150138e+03,  4.586691e+11,  -2.582686e-15, -2.795788e+12, -3.409768e+07, -2.172186e-03, -1.457882e+06,
        -4.153022e+13, -4.255977e-08, 3.216237e-07,  4.935803e+02,  -4.248965e-16, 1.740357e+07,  4.635370e+19,
        -4.099930e-14, 2.758885e-16,  -4.714106e-05, -4.556226e-20, -4.290894e-19, 1.174284e-09,  -1.443257e+16,
        -2.279471e-08, -3.030819e-16, 1.535128e+18,  -3.248271e-07, 3.079855e-21,  -3.056403e-02, -1.368113e-12,
        4.004190e-10,  4.955150e+07,  -2.494283e-16, 2.186037e+05,  -1.232946e+03, 5.586112e-05,  -2.288144e+17,
        2.515602e-19,  -4.064132e+08, -3.217400e-02, -2.620215e+07, 2.283421e-14,  -1.130075e+08, 3.304955e-03,
        1.352402e+01,  6.255755e-03,  -3.913649e-08, 5.474984e+01,  -4.712294e-08, 3.548418e-16,  1.276896e+12,
        2.007320e-08,  3.025617e+04,  -2.544836e+14, -2.087825e+17, -3.285556e-09, 2.605304e+07,  -1.876210e+07,
        3.734943e-10,  -3.862726e-15, -4.227362e-05, 1.267773e+14,  -1.706991e-05, 3.737441e+10,  2.641527e+01,
        4.439891e+10,  -1.444933e-05, -2.190034e-12, 8.059924e-18,  -1.324313e+18, -1.420214e-10, 3.940158e-20,
        3.943349e-02,  -2.685925e+19, 4.334133e-05,  3.171371e-21,  2.094486e+12,  1.331741e+03,  1.205892e-02,
        1.791416e+04,  3.899239e+10,  6.581991e+06,  -3.860368e+11, -3.853916e-02, 1.314566e+09,  3.923126e+03,
        -3.509905e+13, -4.332430e+06, -1.713419e+01, -1.244104e-14, -5.529613e+01, 6.630349e+06,  1.053668e+10,
        3.312332e-05,  -1.252220e+08, 3.997107e-07,  1.847068e-13,  -2.393157e-11, -2.083719e-10, -4.927155e+11,
        2.666499e-15,  4.087292e-10,  4.082567e-10,  -2.017655e+07, 9.108015e+15,  -4.199693e-15, -4.969705e-17,
        1.769881e-02,  1.745504e+00,  2.200377e-16,  -4.404838e-06, -1.317122e-15, 7.210560e+08,  1.282439e-18,
        -3.204957e-06, -1.624277e+05, 4.570975e-22,  1.261776e+04,  4.416193e+12,  -4.343457e-18, 4.095420e-14,
        4.951026e-09,  2.261753e-15,  4.125062e+05,  -4.448849e+11, -3.184924e+06, -2.050956e+05, -9.895539e+09,
        4.541548e+11,  -4.230580e+11, -4.268059e-15, -4.393836e+09, -2.514832e-08, 3.322394e-04,  2.597384e-18,
        1.316619e-11,  -2.250081e+16, 2.179579e-10,  -1.838295e+04, -1.995626e-17, -4.656110e+17, 3.481814e-07,
        -2.859273e-11, -2.011768e-06, -1.809342e-17, -3.242126e+10, -1.873723e+08, -2.833009e-12, -3.758282e+12,
        2.970198e+15,  -2.667738e-01, -3.689173e+11, 1.008362e-10,  -1.526867e-20, -1.439753e+06, -6.154602e+16,
        4.165816e+00,  -1.597823e-09, -1.862803e+14, -2.222766e+15, -2.892587e+17, -4.230426e-14, 2.999121e-21,
        1.642245e+00,  1.590694e-14,  -4.469755e-06, 2.700655e+12,  -1.822443e-02, -4.889338e-16, -3.174990e-11,
        4.146024e-03,  1.313280e+01,  3.235142e+15,  3.500547e+00,  -4.413708e+03, 1.485548e+16,  -1.660821e-11,
        -4.334510e-22, -1.209739e+04, 1.149570e+12,  -4.537849e+00, -3.628402e-16, 2.748853e-12,  -4.818907e-21};
    EXPECT_RRARRAY_EQ(AttachRRArray(d2_b, 392, false), get_d2.GetResult());

    double d2_a[] = {
        8.805544e-12,  3.735066e+12,  3.491919e+17,  4.979833e+12,  -4.042302e+00, 2.927731e-12,  5.945355e+11,
        -3.965351e+06, 4.866934e-14,  1.314597e+04,  -2.059923e-11, -5.447989e-20, 1.267732e-21,  -2.603983e+10,
        2.417961e+03,  3.515469e-16,  1.731329e-01,  -2.854408e-04, 2.908090e-06,  3.354746e+08,  9.405914e+05,
        -3.665276e-01, -2.036897e+02, 3.489765e-01,  -3.207702e+11, -2.105708e+18, -1.485891e+13, -7.059704e+04,
        3.528381e+11,  4.586056e+02,  -8.107050e-16, -1.007106e+09, 2.964453e+05,  -3.628810e+05, -2.816870e-14,
        5.665387e+09,  8.518736e+11,  -1.179981e+12, -1.506569e-21, 1.113076e-06,  -4.782847e+06, 8.906463e+17,
        2.729604e+03,  -3.430604e+16, 2.626956e-07,  1.543395e+15,  3.407777e-21,  1.231519e+06,  -4.808410e+16,
        2.649811e+10,  2.546524e+01,  -3.533472e-13, -3.732759e+04, 1.951505e-20,  9.338953e-21,  -1.627672e-04,
        1.807084e-19,  -4.489206e-17, -2.654284e+08, -2.136947e+16, -3.690031e+09, 3.372245e-14,  4.946361e-11,
        -1.330965e-01, 2.479789e-17,  2.750331e-18,  -4.301452e-03, 3.895091e+19,  2.515863e+13,  6.879298e+12,
        -2.925884e-15, -2.826248e+00, -4.864526e-06, 2.614765e+00,  4.488816e-19,  2.231337e+15,  -7.004595e+07,
        2.506835e-08,  -2.187450e-02, -2.220025e-07, 1.688346e+02,  8.125250e-07,  -4.819391e+10, -1.643306e-14,
        -4.768222e-18, -4.472162e-16, 2.487563e-01,  -3.924904e-15, -1.186331e+06, 2.397369e+01,  -3.137448e-02,
        1.016507e+06,  2.584749e-16,  8.212180e-08,  1.631561e-12,  -4.927066e-08, 1.448920e-14,  -4.371505e+03,
        2.050871e-21,  2.523287e+01,  7.778552e-05,  -4.437786e+18, -1.118552e-07, -3.543717e-09, -5.327587e-07,
        -1.083197e-17, 2.578295e-10,  -4.952430e-12, -3.008597e-13, 3.010829e+01,  -6.109332e+09, -2.428341e-03,
        9.399191e-01,  -4.827230e-06, 1.013860e+10,  -2.870341e-20, 4.281756e+11,  1.043519e-09,  2.378027e+06,
        2.605309e+09,  -4.939600e-04, -2.193966e+08, 4.022755e-03,  2.668705e-09,  -1.087393e-18, 1.927676e-12,
        -1.694835e+10, 3.554035e-03,  -1.299796e+01, -1.692862e+07, 2.818156e+07,  -2.606821e-13, 1.629588e-15,
        -7.069991e-16, 1.205863e-19,  2.491209e-17,  -3.757951e+04, 3.110266e-04,  -4.339472e+11, -3.172428e+02,
        1.579905e+09,  2.859499e-01,  4.241852e-06,  2.043341e-09,  2.922865e-16,  -2.580974e+01, -3.147566e-02,
        1.160590e+03,  -2.238096e+01, -1.984601e-13, 2.636096e-03,  8.422872e-04,  2.026040e-16,  -3.822500e+01,
        -2.190513e-18, 3.229839e-11,  -2.958164e+06, -8.354021e+11, 3.625367e+08,  -4.558085e-01, 1.274325e+04,
        -2.492750e+05, 3.739269e+18,  -3.985407e-03, 3.575816e-13,  1.376847e+06,  -6.682659e-20, -9.200014e+08,
        -2.278973e+10, -3.555184e-04, 3.821512e-10,  5.944167e+07,  -2.576511e-15, 1.232459e+02,  -3.187831e+02,
        -4.882568e+12, -1.670486e+05, -2.339878e-20, -4.985496e-16, -2.937093e+17, 8.981723e-06,  -5.460686e-04,
        1.090528e-11,  -4.321598e+17, -3.577227e-08, 2.880194e+01,  -4.277921e+00, -4.145678e-02, 4.930810e+08,
        -4.525745e-21, 4.648764e+07,  -2.564920e+16, 1.075546e+01,  3.777591e-18,  1.419816e-08,  1.419490e+10,
        1.479453e-19,  -4.933130e+13, 4.580471e+15,  -3.160785e+02, -2.885209e+06, 2.384424e-03,  1.030777e-12,
        2.652784e+04,  4.435144e+10,  3.102484e+17,  4.725294e+11,  -3.817788e-04, 4.074841e-01,  -7.248042e-13,
        -4.502531e-08, 2.203521e+01,  -4.457124e+01, -2.961745e+06, -3.237080e+14, -3.482497e-19, 1.534088e+05,
        4.759060e-14,  2.333791e+04,  -4.002051e-03, 3.278553e-06,  -2.307217e+13, -2.999411e+19, -9.804484e+02,
        -1.793367e+01, 3.111735e+07,  -4.457329e+10, -2.067659e-13, -5.927573e+03, 6.979879e+10,  3.556110e-06,
        -3.513094e-13, 1.128057e+19,  4.199038e+13,  7.553080e-20,  4.380028e-11,  -2.502103e-19, 5.943049e+15,
        -1.266134e-10, 4.825578e-09,  -2.778134e-16, 1.881866e-10,  -3.677556e+08, -2.166345e-10, 3.919158e+05,
        2.778912e-07,  1.822489e-05,  1.513496e-01,  9.327925e+05,  -4.050132e-14, 3.311913e+01,  9.290544e+15,
        1.302267e+03,  -1.252080e+17, -4.208811e-04, -3.225464e+16, 2.093787e+16,  -3.352116e+07, 4.797665e+15,
        -1.539672e-17, 4.835159e+04,  2.446236e-07,  2.355328e-17,  2.044244e-12,  3.210415e-11,  -1.322741e+16,
        5.538184e-14,  -4.612046e-05, 4.758939e+15,  -2.038208e-10, -2.451148e+18, -2.699711e-19, -2.019804e-09,
        5.631634e-13,  -2.288031e+05, -3.211488e+12, 7.511869e+13,  -3.209453e-09, 3.806128e-18,  4.025006e-14,
        -1.700945e-10, 4.136280e-13,  4.517870e-04,  2.739233e+11,  -3.736057e-03, 2.255379e-20,  3.122584e-16,
        3.192660e-18,  4.765755e-09,  2.396494e-13,  1.625326e+02,  -3.413821e-18, 3.627586e+10,  8.708108e+07,
        2.244241e-09,  3.718827e-02,  1.803394e-18,  4.377806e-04,  1.593155e-04,  -2.886859e+19, 2.446955e-06,
        4.714172e-07,  -1.444181e+14, 5.921228e-22,  -3.968436e+05, 2.081487e+08,  4.200042e+18,  -1.334353e-20,
        1.637913e+12,  -7.203262e+03, 3.510359e+09,  5.945107e-08,  2.798793e-07,  1.819020e+17,  -1.331690e+02,
        -2.714485e+18, -2.344350e-18, -1.313232e-20, -6.739364e-22, 1.025007e-02,  1.186976e+07,  -1.412268e+09,
        -6.194861e-18, -4.523625e-03, -4.504270e-06, 2.158726e-21,  -8.330465e-17, 4.566938e+11,  6.677905e-05,
        -2.312717e-13, 5.325983e+16,  -1.075392e-04, 1.140532e-13,  2.606136e-11,  -2.815243e+16, -3.550714e-16,
        -1.033372e+05, -1.183041e+03, -7.872171e-21, -4.362058e-07, -3.181126e-07, -2.676671e+18, -2.674920e-15,
        -3.991169e-16, -4.401799e+07, -2.826847e-10, -2.033266e-20, -5.669789e-11, 3.711339e+05,  -1.194584e-17,
        -3.310173e+10, -1.743331e-15, -2.288755e+15, 8.610375e+06,  4.796813e+07,  -1.465344e+07, -4.074823e-12,
        2.089962e-21,  -4.171761e-18, -4.682371e+18, 4.030447e+08,  4.679856e-07,  -2.662732e+15, 2.551805e-21,
        2.482089e+05,  -2.310281e-10, 3.533837e-08,  1.829437e-07,  3.074466e-06,  -2.889997e-12, -4.203806e+01,
        1.598374e-21,  -1.300526e-05, 2.921093e+14,  -8.847920e+14, 3.788583e-04,  -4.538453e+19, -2.734893e+07,
        1.351281e-04,  1.128593e-01,  3.868545e+13,  -1.200438e+18, -2.641822e+10, -4.493835e-16, -6.291094e-13,
        2.534337e-08,  -4.063653e-03, 3.200675e-02,  2.243642e+08,  5.170843e-08,  8.984841e-14,  2.228243e-01,
        -6.770559e-09, 3.513375e-16,  -2.512038e-14, 3.421696e+04,  -4.514522e+01, -1.062799e-20, 2.853168e-19,
        8.503515e-21,  -1.664790e-03, -2.515606e-18, 1.237958e-21,  -8.059224e-20, 4.386086e+00,  5.301466e+17,
        4.388106e-12,  -3.432129e+00, 2.189230e+18,  -1.806446e-02, 3.266789e-18,  3.355664e-13,  -1.206966e-21,
        -4.813560e-02, -1.352049e+18, 1.257234e-07,  2.511470e-09,  -2.512775e-01, 3.613773e-10,  -9.065202e+16,
        -1.777852e+18, 1.444606e-01,  -2.857379e+00, -1.912993e+00, 3.436817e-09,  -1.749039e+14, 2.215154e-18,
        3.384923e+18,  -4.513038e-09, 4.814904e+05,  3.730911e+15,  1.861706e+12,  3.378290e-03,  2.851468e-06,
        -1.577518e-04, -4.122504e-12, -2.743002e+03, 8.512568e-02,  -1.333039e-09, -4.899609e-17, -1.782085e-11,
        2.552482e-02,  4.200193e+10,  -4.298147e+03, -1.923210e-10, -1.208889e+01, 4.606772e-21,  -3.331241e+10,
        -3.704566e-16, -3.733178e-20, -4.950049e+16, 3.184384e+15,  -4.107375e-06, 1.801875e+09,  9.632951e-16,
        7.172728e-10,  2.324621e+07,  2.892586e+15,  -1.582511e-17, -4.119044e-13, -1.248361e+09, 1.531907e+08,
        -1.795628e-19, -1.735919e-17, -4.646689e-07, -2.779304e-11, 8.048984e-10,  3.536087e-02,  -6.494880e+18,
        2.714073e+06,  3.374557e+18,  3.621468e-06,  2.742652e-07,  2.551176e+03,  -4.420578e+18, -4.370624e-08,
        -4.507765e-11, 4.193746e-20,  1.206645e+13,  -3.750231e+03, 4.390893e+08,  -9.756466e+11, 3.392778e-06,
        -3.453465e+01, -1.406102e+11, -3.673526e-15, 1.417082e-03,  1.499926e+16,  -4.471032e-17, -2.657920e+16,
        4.792261e+09,  -3.212735e+17, -3.372737e-05, -4.730048e+01, 3.365478e+07,  2.835695e+13,  -3.242022e-07,
        3.640288e+11,  1.862055e-08,  -4.121250e-19, -3.891100e-02, -4.367058e-15, 1.364067e-17,  -4.575429e-12,
        3.621347e-07,  1.506864e+11,  3.715065e+18,  -1.773352e+08, -3.502359e+07, -2.326890e-04, 2.948814e-17,
        -2.438988e+14, -2.994787e+04, -3.755515e+12, 2.708013e-13,  3.281046e-01,  -3.710727e+12, -8.380304e+14,
        1.062737e-05,  2.385939e+16,  -4.383210e-20, -3.779417e+03, 3.080324e-03,  3.810188e+16,  3.058415e+00,
        -2.484879e-21, -1.951684e+01, 6.979033e-10,  -3.866994e+06, 4.278936e-19,  9.365131e+10,  -3.685205e+01,
        -2.678752e-16, 2.011434e-19,  1.884072e+08,  -1.300910e+04, 2.414058e-09,  -4.675979e+11, 3.583361e-19,
        -4.499438e+18, 1.641999e-21,  -2.686795e-10, 6.136688e-20,  -3.793690e+16, 4.944562e-20,  -3.490443e-03,
        3.080547e+02,  2.041413e-06,  2.021979e+03,  2.314233e-06,  1.564131e-01,  -8.712542e+17, 7.569081e+16,
        -1.056907e+17, 2.095024e-14,  -2.487621e+17, -3.490381e+19, -6.944641e-01, -2.892354e-08, -3.597351e+12,
        -1.985424e+06, -2.348859e+09, -1.657051e+01, -3.358823e+14, 3.219974e-16,  -4.819092e-13, -2.905178e-11,
        8.257664e+04,  -4.092466e-15, -3.464711e-13, -3.956400e-14, -2.548275e-08, -8.917872e-21, 7.387291e+13,
        2.300996e+16,  -4.870764e+18, -9.909380e-03, 1.260429e-08,  -3.409396e-12, 1.003848e+02,  -4.883178e-02,
        -3.125474e-14, 1.005294e+11,  -4.736012e+09, -1.647544e-09, -3.491431e-03, 4.619061e+07,  -4.547601e-09,
        -3.788900e-02, -2.648380e-17, 4.601877e-16,  1.754357e+13,  4.325616e+12,  1.860822e+03,  4.080727e+15,
        -4.573470e-14, -1.293538e+16, 2.811449e+05,  4.032351e+06,  4.274005e+04,  3.454035e-21,  4.933014e+09,
        -3.712562e+08, 3.158678e+06,  -1.636782e+11, -2.884298e-18, -3.685740e-17, 1.027472e-07,  -3.765173e-12,
        2.740894e-17,  2.634880e+02,  -4.334010e+00, -3.708285e-14, -3.858731e+16, -3.956687e+13, -4.064064e-12,
        2.558646e-05,  4.459143e+03,  -9.661948e+03, -1.994335e+16, 1.202714e-17,  -3.782707e-17, 9.099692e-04,
        -1.864561e+09, 3.493877e-08,  4.288188e-01,  1.767126e-14,  -6.779451e-22, -1.977471e-09, -3.536454e+06,
        -7.319495e-04, 2.004028e-16,  -3.181521e-17, 3.336202e+14,  -2.752423e+07, 3.390953e+01,  4.199625e-15,
        2.883232e-12,  3.122912e-06,  7.324619e-19,  3.092709e-02,  -2.758364e-15, -2.489492e+12, -1.622009e-08,
        2.371204e+06,  -1.582081e+08, -6.382371e-17};
    IOContextThreadPool_AsyncResultAdapter<void> set_d2(io_context);
    ASSERT_NO_THROW(c->async_set_d2(AttachRRArrayCopy(d2_a, 647), set_d2));
    set_d2.GetResult();

    IOContextThreadPool_AsyncResultAdapter<void> disconnect_res(io_context);
    ASSERT_NO_THROW(RobotRaconteurNode::s()->AsyncDisconnectService(c1, disconnect_res));
    disconnect_res.GetResult();
}

} // namespace RobotRaconteurTest
